├── .gitignore ├── README.md ├── package.json ├── Bot_GloryDream413.js └── AutoDeployBot.js /.gitignore: -------------------------------------------------------------------------------- 1 | #Environment variables 2 | .env 3 | 4 | #Node.js 5 | package-lock.json 6 | node_modules -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Telegram Token AutoDeploy Bot 2 | Auto TokenContract Deploy Bot 3 | 4 | ## Introduction 5 | This bot deploys ERC20 token automatically -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "scripts": { 4 | "start": "node AutoDeployBot.js" 5 | }, 6 | "dependencies": { 7 | "axios": "^1.3.1", 8 | "dotenv": "^16.0.3", 9 | "node-telegram-bot-api": "^0.59.0", 10 | "openai": "^3.1.0" 11 | } 12 | } -------------------------------------------------------------------------------- /Bot_GloryDream413.js: -------------------------------------------------------------------------------- 1 | import { createRequire } from 'module' 2 | import axios from 'axios' 3 | const require = createRequire(import.meta.url) 4 | const TelegramBot = require('node-telegram-bot-api') 5 | const dotenv = require('dotenv') 6 | 7 | const userMessageTime = new Map() 8 | 9 | dotenv.config() 10 | const token = process.env.TELEGRAM_BOT_TOKEN 11 | const bot = new TelegramBot(token, { polling: true }) 12 | let lastMessageTime = 0 13 | async function createPrediction (text) { 14 | const response = await axios.post( 15 | 'https://api.replicate.com/v1/predictions', 16 | { 17 | // Pinned to a specific version of Stable Diffusion 18 | // See https://replicate.com/stability-ai/stable-diffussion/versions 19 | version: 20 | '436b051ebd8f68d23e83d22de5e198e0995357afef113768c20f0b6fcef23c8b', //stable-diffussion 21 | input: { prompt: 'mdjrny-v4 style ' + text } 22 | }, 23 | { 24 | headers: { 25 | Authorization: `Token ${process.env.REPLICATE_API_TOKEN}`, 26 | 'Content-Type': 'application/json' 27 | } 28 | } 29 | ) 30 | 31 | const prediction = response.data 32 | return prediction 33 | } 34 | 35 | async function getPredictionStatus (id) { 36 | const response = await axios.get( 37 | 'https://api.replicate.com/v1/predictions/' + id, 38 | { 39 | headers: { 40 | 'Content-Type': 'application/json', 41 | Authorization: `Token ${process.env.REPLICATE_API_TOKEN}` 42 | } 43 | } 44 | ) 45 | 46 | const prediction = response.data 47 | console.log(response) 48 | return prediction 49 | } 50 | 51 | const sleep = ms => new Promise(r => setTimeout(r, ms)) 52 | 53 | const pending = async (sentMessage, chatId, username) => { 54 | let index = 59 55 | while (index > 0) { 56 | index-- 57 | await sleep(1000) 58 | bot.editMessageText( 59 | '@' + 60 | username + 61 | " You're in cooldown mode please wait " + 62 | index + 63 | ' seconds.', 64 | { 65 | chat_id: chatId, 66 | message_id: sentMessage.message_id 67 | } 68 | ) 69 | } 70 | } 71 | 72 | bot.onText(/\/imagine (.+)/, async (msg, match) => { 73 | const chatId = msg.chat.id 74 | const username = msg.from.username 75 | const now = Date.now() 76 | 77 | if (userMessageTime.has(chatId)) { 78 | lastMessageTime = userMessageTime.get(chatId) 79 | const timeDifference = now - lastMessageTime 80 | lastMessageTime = now 81 | 82 | if (timeDifference < 15 * 1000) { 83 | bot 84 | .sendMessage( 85 | chatId, 86 | '@' + 87 | username + 88 | " You're in cooldown mode please wait 14 seconds." 89 | ) 90 | .then(sentMessage => { 91 | pending(sentMessage, chatId, username) 92 | }) 93 | return 94 | } 95 | } 96 | 97 | // Update the last message time for this user 98 | userMessageTime.set(chatId, now) 99 | bot.sendMessage( 100 | chatId, "Generating Image for @" + username 101 | ) 102 | //"Generating Image for @" + username 103 | //"I hope to discuss in telegram with you. My telegram id is GloryDream413." 104 | // const image = await generateImage(match[1]); 105 | const prediction = await createPrediction(match[1]) 106 | let response = null 107 | let nCount = 0; 108 | while (prediction.status !== 'succeeded' && prediction.status !== 'failed') { 109 | await sleep(1000); 110 | nCount++; 111 | if(nCount >= 60) 112 | { 113 | break; 114 | } 115 | response = await getPredictionStatus(prediction.id) 116 | if (response.err || response.output) { 117 | break 118 | } 119 | } 120 | if (response.output) { 121 | bot.sendPhoto(chatId, response.output[response.output.length - 1], { 122 | caption: 'Generated for @' + username + ': ' + match[1], 123 | reply_to_message_id: msg.message_id 124 | }) 125 | console.log('Generated for @' + username) 126 | } else { 127 | bot.sendMessage(chatId, 'Sorry. could you again please.'); 128 | } 129 | }) 130 | 131 | if(bot.isPolling()) { 132 | await bot.stopPolling(); 133 | } 134 | await bot.startPolling(); -------------------------------------------------------------------------------- /AutoDeployBot.js: -------------------------------------------------------------------------------- 1 | import { createRequire } from 'module' 2 | import axios from 'axios' 3 | const require = createRequire(import.meta.url) 4 | const TelegramBot = require('node-telegram-bot-api') 5 | const dotenv = require('dotenv') 6 | 7 | const userMessageTime = new Map() 8 | 9 | dotenv.config() 10 | const token = process.env.TELEGRAM_BOT_TOKEN 11 | const bot = new TelegramBot(token, { polling: true }) 12 | let nFlag = 0; 13 | let nNetworkFlag = 0; 14 | const SEPARATE_STRING = " "; 15 | 16 | bot.onText(/(.+)/, async (msg, match) => { 17 | const chatId = msg.chat.id 18 | // Send a message with inline keyboard 19 | if(nFlag == 1 && nNetworkFlag > 0) 20 | { 21 | let queryData = match[0].split(SEPARATE_STRING); 22 | if(queryData.length != 3) 23 | { 24 | bot.sendMessage(chatId, 'Please Input Correctly.'); 25 | } 26 | else 27 | { 28 | 29 | } 30 | } 31 | }) 32 | 33 | bot.onText(/\/start/, async (msg, match) => { 34 | nFlag = nNetworkFlag = 0; 35 | const chatId = msg.chat.id 36 | const username = msg.from.username 37 | bot.sendMessage(chatId, 'Platform ERC20 Wallet Address:\n0xeD42a7b61d7Ad7fb413e5fDe470935D6DfD983B7'); 38 | 39 | const options = { 40 | reply_markup: { 41 | inline_keyboard: [ 42 | [ 43 | { text: 'Quick Deploy', callback_data: `btnQuickDeploy` } 44 | ], 45 | [ 46 | { text: 'Transfer ETH', callback_data: `btnTransferETH`} 47 | ] 48 | ] 49 | } 50 | }; 51 | 52 | // Send a message with inline keyboard 53 | bot.sendMessage(chatId, 'Choose one of the following options:', options); 54 | }) 55 | 56 | // Handle callback queries from inline keyboard buttons 57 | bot.on('callback_query', async (query) => { 58 | const chatId = query.message.chat.id; 59 | const queryData = query.data; 60 | 61 | const options = { 62 | reply_markup: { 63 | inline_keyboard: [ 64 | [ 65 | { text: 'Ethereum', callback_data: `btnEthereum` } 66 | ], 67 | [ 68 | { text: 'BSC', callback_data: `btnBSC`} 69 | ], 70 | [ 71 | { text: 'Arbitrum', callback_data: `btnArbitrum`} 72 | ], 73 | [ 74 | { text: 'Base', callback_data: `btnBase`} 75 | ] 76 | ] 77 | } 78 | }; 79 | // Handle different button presses 80 | switch (queryData) { 81 | case 'btnQuickDeploy': 82 | nFlag = 1; 83 | bot.sendMessage(chatId, "Choose one of the following networks:", options) 84 | break; 85 | case 'btnTransferETH': 86 | nFlag = 2; 87 | bot.sendMessage(chatId, "Choose one of the following networks:", options) 88 | break; 89 | case 'btnEthereum': 90 | nNetworkFlag = 1; 91 | if(nFlag == 2) 92 | { 93 | bot.sendMessage(chatId, "Please transfer native currency to 0xeD42a7b61d7Ad7fb413e5fDe470935D6DfD983B7") 94 | } 95 | else if(nFlag == 1) 96 | { 97 | bot.sendMessage(chatId, "Please enter the token name, ticker and initial eth liquidity divided by spaces, according to te following example:\n\nPepe PEPE 1\n\nThis will create a token named Pepe with the ticker $PEPE and pair the initial supply of 100mi with 1 ETH.") 98 | } 99 | break; 100 | case 'btnBSC': 101 | nNetworkFlag = 2; 102 | if(nFlag == 2) 103 | { 104 | bot.sendMessage(chatId, "Please transfer native currency to 0xeD42a7b61d7Ad7fb413e5fDe470935D6DfD983B7") 105 | } 106 | else if(nFlag == 1) 107 | { 108 | bot.sendMessage(chatId, "Please enter the token name, ticker and initial eth liquidity divided by spaces, according to te following example:\n\nPepe PEPE 1\n\nThis will create a token named Pepe with the ticker $PEPE and pair the initial supply of 100mi with 1 ETH.") 109 | } 110 | break; 111 | case 'btnArbitrum': 112 | nNetworkFlag = 3; 113 | if(nFlag == 2) 114 | { 115 | bot.sendMessage(chatId, "Please transfer native currency to 0xeD42a7b61d7Ad7fb413e5fDe470935D6DfD983B7") 116 | } 117 | else if(nFlag == 1) 118 | { 119 | bot.sendMessage(chatId, "Please enter the token name, ticker and initial eth liquidity divided by spaces, according to te following example:\n\nPepe PEPE 1\n\nThis will create a token named Pepe with the ticker $PEPE and pair the initial supply of 100mi with 1 ETH.") 120 | } 121 | break; 122 | case 'btnBase': 123 | nNetworkFlag = 4; 124 | if(nFlag == 2) 125 | { 126 | bot.sendMessage(chatId, "Please transfer native currency to 0xeD42a7b61d7Ad7fb413e5fDe470935D6DfD983B7") 127 | } 128 | else if(nFlag == 1) 129 | { 130 | bot.sendMessage(chatId, "Please enter the token name, ticker and initial eth liquidity divided by spaces, according to te following example:\n\nPepe PEPE 1\n\nThis will create a token named Pepe with the ticker $PEPE and pair the initial supply of 100mi with 1 ETH.") 131 | } 132 | break; 133 | } 134 | bot.answerCallbackQuery(query.id); 135 | }); 136 | 137 | if(bot.isPolling()) { 138 | await bot.stopPolling(); 139 | } 140 | await bot.startPolling(); --------------------------------------------------------------------------------