|
import os |
|
|
|
# C贸digo de tu aplicaci贸n aqu铆 |
|
|
|
if __name__ == "__main__": |
|
os.system("python main.py") |
|
const TelegramBot = require('node-telegram-bot-api'); |
|
const Web3 = require('web3'); |
|
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR_PROJECT_ID')); |
|
|
|
const contractAddress = data; |
|
const contractABI = [...]; |
|
|
|
|
|
const bot(0x68749665FF8D2d112Fa859AA293F07A622782F38) = new TelegramBot('6616997752:AAEU4xrcNzdykjr1flv3BpqKNq1NZCHLEcE', {polling: true}); |
|
|
|
bot.on('message', async (msg) => { |
|
const chatId = msg.chat.id; |
|
const text = msg.text; |
|
|
|
if (text === '/start') { |
|
await bot.sendMessage(chatId, '隆Bienvenido al bot de pago de Ethereum!'); |
|
} else if (text === '/pay') { |
|
const userWalletAddress = sessionStorage.getItem('userWalletAddress'); |
|
const amountToPay = sessionStorage.getItem('amountToPay'); |
|
|
|
if (!userWalletAddress || !amountToPay) { |
|
await bot.sendMessage(chatId, 'Por favor, configure la billetera y el monto a pagar antes de realizar el pago.'); |
|
return; |
|
} |
|
|
|
const contract = new web3.eth.Contract(contractABI, contractAddress); |
|
try { |
|
await contract.methods.pay(userWalletAddress, amountToPay).send({ from: '0x...', gas: 1000000 }); |
|
await bot.sendMessage(chatId, '隆Transacci贸n realizada exitosamente!'); |
|
} catch (error) { |
|
await |
|
bot.sendMessage(chatId, `Error al realizar la transacci贸n: ${error.message}`); |
|
} |
|
} else { |
|
await bot.sendMessage(chatId, 'Comando no v谩lido. Por favor, utiliza /start o /pay.'); |
|
} |
|
}); |
|
|
|
/startBot (i); |
|
/openMiner(extract500000 XAUT"TETHER GOLD") |
|
|
|
|
|
|