├── Procfile ├── requirements.txt ├── app.json ├── README.md └── main.py /Procfile: -------------------------------------------------------------------------------- 1 | Vick: python3 main.py 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyrogram==1.4.16 2 | pymongo 3 | requests 4 | dnspython 5 | tgcrypto==1.2.2 6 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "VickMachineBot", 3 | "env": { 4 | "BOT_TOKEN": { 5 | "description": "telegram bot token here", 6 | "required": true 7 | }, 8 | "MONGO_URL": { 9 | "description": "mongo db url here", 10 | "required": true 11 | }, 12 | "API_ID": { 13 | "description": "telegram api id here", 14 | "required": true 15 | }, 16 | "API_HASH": { 17 | "description": "telegram api hash here", 18 | "required": true 19 | } 20 | }, 21 | "addons": [ 22 | { 23 | "plan": "heroku-postgresql" 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About 2 | An Advanced Telegram Chatbot Open Sorce Code 3 | 4 | Note : 📝 VickMachineBot Is Not My Bot 5 | ## How To Host 6 | The easiest way to deploy this Bot 7 | • Enter your ```MONGO_URL```,```API_ID```,```API_HASH``` And ```TOKEN```. 8 |

9 | 10 | ### Reach Me 11 | 12 |

13 | 14 | ### Support 15 | 16 |

17 | 18 |

19 | 20 | ## © Copyright - MetaVoid (Moezilla) 21 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.types import * 3 | from pymongo import MongoClient 4 | import requests 5 | import random 6 | import os 7 | import re 8 | 9 | 10 | API_ID = os.environ.get("API_ID", None) 11 | API_HASH = os.environ.get("API_HASH", None) 12 | BOT_TOKEN = os.environ.get("BOT_TOKEN", None) 13 | MONGO_URL = os.environ.get("MONGO_URL", None) 14 | 15 | 16 | bot = Client( 17 | "VickBot" , 18 | api_id = API_ID, 19 | api_hash = API_HASH , 20 | bot_token = BOT_TOKEN 21 | ) 22 | 23 | 24 | async def is_admins(chat_id: int): 25 | return [ 26 | member.user.id 27 | async for member in bot.iter_chat_members( 28 | chat_id, filter="administrators" 29 | ) 30 | ] 31 | 32 | 33 | @bot.on_message(filters.command("start")) 34 | async def start(client, message): 35 | await message.reply_text("Hi! My name is Ishi. I'm an Artificial Intelligence\n /chatbot - [on|off]") 36 | 37 | 38 | @bot.on_message( 39 | filters.command("chatbot off", prefixes=["/", ".", "?", "-"]) 40 | & ~filters.private) 41 | async def chatbotofd(client, message): 42 | vickdb = MongoClient(MONGO_URL) 43 | vick = vickdb["VickDb"]["Vick"] 44 | if message.from_user: 45 | user = message.from_user.id 46 | chat_id = message.chat.id 47 | if user not in ( 48 | await is_admins(chat_id) 49 | ): 50 | return await message.reply_text( 51 | "You are not admin" 52 | ) 53 | is_vick = vick.find_one({"chat_id": message.chat.id}) 54 | if not is_vick: 55 | vick.insert_one({"chat_id": message.chat.id}) 56 | await message.reply_text(f"Chatbot Disabled!") 57 | if is_vick: 58 | await message.reply_text(f"ChatBot Is Already Disabled") 59 | 60 | 61 | @bot.on_message( 62 | filters.command("chatbot on", prefixes=["/", ".", "?", "-"]) 63 | & ~filters.private) 64 | async def chatboton(client, message): 65 | vickdb = MongoClient(MONGO_URL) 66 | vick = vickdb["VickDb"]["Vick"] 67 | if message.from_user: 68 | user = message.from_user.id 69 | chat_id = message.chat.id 70 | if user not in ( 71 | await is_admins(chat_id) 72 | ): 73 | return await message.reply_text( 74 | "You are not admin" 75 | ) 76 | is_vick = vick.find_one({"chat_id": message.chat.id}) 77 | if not is_vick: 78 | await message.reply_text(f"Chatbot Is Already Enabled") 79 | if is_vick: 80 | vick.delete_one({"chat_id": message.chat.id}) 81 | await message.reply_text(f"ChatBot Is Enable!") 82 | 83 | 84 | @bot.on_message( 85 | filters.command("chatbot", prefixes=["/", ".", "?", "-"]) 86 | & ~filters.private) 87 | async def chatbot(client, message): 88 | await message.reply_text(f"**Usage:**\n/chatbot [on|off] only group") 89 | 90 | 91 | @bot.on_message( 92 | ( 93 | filters.text 94 | | filters.sticker 95 | ) 96 | & ~filters.private 97 | & ~filters.bot, 98 | ) 99 | async def vickai(client: Client, message: Message): 100 | 101 | chatdb = MongoClient(MONGO_URL) 102 | chatai = chatdb["Word"]["WordDb"] 103 | 104 | if not message.reply_to_message: 105 | vickdb = MongoClient(MONGO_URL) 106 | vick = vickdb["VickDb"]["Vick"] 107 | is_vick = vick.find_one({"chat_id": message.chat.id}) 108 | if not is_vick: 109 | await bot.send_chat_action(message.chat.id, "typing") 110 | K = [] 111 | is_chat = chatai.find({"word": message.text}) 112 | k = chatai.find_one({"word": message.text}) 113 | if k: 114 | for x in is_chat: 115 | K.append(x['text']) 116 | hey = random.choice(K) 117 | is_text = chatai.find_one({"text": hey}) 118 | Yo = is_text['check'] 119 | if Yo == "sticker": 120 | await message.reply_sticker(f"{hey}") 121 | if not Yo == "sticker": 122 | await message.reply_text(f"{hey}") 123 | 124 | if message.reply_to_message: 125 | vickdb = MongoClient(MONGO_URL) 126 | vick = vickdb["VickDb"]["Vick"] 127 | is_vick = vick.find_one({"chat_id": message.chat.id}) 128 | getme = await bot.get_me() 129 | bot_id = getme.id 130 | if message.reply_to_message.from_user.id == bot_id: 131 | if not is_vick: 132 | await bot.send_chat_action(message.chat.id, "typing") 133 | K = [] 134 | is_chat = chatai.find({"word": message.text}) 135 | k = chatai.find_one({"word": message.text}) 136 | if k: 137 | for x in is_chat: 138 | K.append(x['text']) 139 | hey = random.choice(K) 140 | is_text = chatai.find_one({"text": hey}) 141 | Yo = is_text['check'] 142 | if Yo == "sticker": 143 | await message.reply_sticker(f"{hey}") 144 | if not Yo == "sticker": 145 | await message.reply_text(f"{hey}") 146 | if not message.reply_to_message.from_user.id == bot_id: 147 | if message.sticker: 148 | is_chat = chatai.find_one({"word": message.reply_to_message.text, "id": message.sticker.file_unique_id}) 149 | if not is_chat: 150 | chatai.insert_one({"word": message.reply_to_message.text, "text": message.sticker.file_id, "check": "sticker", "id": message.sticker.file_unique_id}) 151 | if message.text: 152 | is_chat = chatai.find_one({"word": message.reply_to_message.text, "text": message.text}) 153 | if not is_chat: 154 | chatai.insert_one({"word": message.reply_to_message.text, "text": message.text, "check": "none"}) 155 | 156 | 157 | @bot.on_message( 158 | ( 159 | filters.sticker 160 | | filters.text 161 | ) 162 | & ~filters.private 163 | & ~filters.bot, 164 | ) 165 | async def vickstickerai(client: Client, message: Message): 166 | 167 | chatdb = MongoClient(MONGO_URL) 168 | chatai = chatdb["Word"]["WordDb"] 169 | 170 | if not message.reply_to_message: 171 | vickdb = MongoClient(MONGO_URL) 172 | vick = vickdb["VickDb"]["Vick"] 173 | is_vick = vick.find_one({"chat_id": message.chat.id}) 174 | if not is_vick: 175 | await bot.send_chat_action(message.chat.id, "typing") 176 | K = [] 177 | is_chat = chatai.find({"word": message.sticker.file_unique_id}) 178 | k = chatai.find_one({"word": message.text}) 179 | if k: 180 | for x in is_chat: 181 | K.append(x['text']) 182 | hey = random.choice(K) 183 | is_text = chatai.find_one({"text": hey}) 184 | Yo = is_text['check'] 185 | if Yo == "text": 186 | await message.reply_text(f"{hey}") 187 | if not Yo == "text": 188 | await message.reply_sticker(f"{hey}") 189 | 190 | if message.reply_to_message: 191 | vickdb = MongoClient(MONGO_URL) 192 | vick = vickdb["VickDb"]["Vick"] 193 | is_vick = vick.find_one({"chat_id": message.chat.id}) 194 | getme = await bot.get_me() 195 | bot_id = getme.id 196 | if message.reply_to_message.from_user.id == bot_id: 197 | if not is_vick: 198 | await bot.send_chat_action(message.chat.id, "typing") 199 | K = [] 200 | is_chat = chatai.find({"word": message.text}) 201 | k = chatai.find_one({"word": message.text}) 202 | if k: 203 | for x in is_chat: 204 | K.append(x['text']) 205 | hey = random.choice(K) 206 | is_text = chatai.find_one({"text": hey}) 207 | Yo = is_text['check'] 208 | if Yo == "text": 209 | await message.reply_text(f"{hey}") 210 | if not Yo == "text": 211 | await message.reply_sticker(f"{hey}") 212 | if not message.reply_to_message.from_user.id == bot_id: 213 | if message.text: 214 | is_chat = chatai.find_one({"word": message.reply_to_message.sticker.file_unique_id, "text": message.text}) 215 | if not is_chat: 216 | toggle.insert_one({"word": message.reply_to_message.sticker.file_unique_id, "text": message.text, "check": "text"}) 217 | if message.sticker: 218 | is_chat = chatai.find_one({"word": message.reply_to_message.sticker.file_unique_id, "text": message.sticker.file_id}) 219 | if not is_chat: 220 | chatai.insert_one({"word": message.reply_to_message.sticker.file_unique_id, "text": message.sticker.file_id, "check": "none"}) 221 | 222 | 223 | 224 | @bot.on_message( 225 | ( 226 | filters.text 227 | | filters.sticker 228 | ) 229 | & filters.private 230 | & ~filters.bot, 231 | ) 232 | async def vickprivate(client: Client, message: Message): 233 | 234 | chatdb = MongoClient(MONGO_URL) 235 | chatai = chatdb["Word"]["WordDb"] 236 | if not message.reply_to_message: 237 | await bot.send_chat_action(message.chat.id, "typing") 238 | K = [] 239 | is_chat = chatai.find({"word": message.text}) 240 | for x in is_chat: 241 | K.append(x['text']) 242 | hey = random.choice(K) 243 | is_text = chatai.find_one({"text": hey}) 244 | Yo = is_text['check'] 245 | if Yo == "sticker": 246 | await message.reply_sticker(f"{hey}") 247 | if not Yo == "sticker": 248 | await message.reply_text(f"{hey}") 249 | if message.reply_to_message: 250 | getme = await bot.get_me() 251 | bot_id = getme.id 252 | if message.reply_to_message.from_user.id == bot_id: 253 | await bot.send_chat_action(message.chat.id, "typing") 254 | K = [] 255 | is_chat = chatai.find({"word": message.text}) 256 | for x in is_chat: 257 | K.append(x['text']) 258 | hey = random.choice(K) 259 | is_text = chatai.find_one({"text": hey}) 260 | Yo = is_text['check'] 261 | if Yo == "sticker": 262 | await message.reply_sticker(f"{hey}") 263 | if not Yo == "sticker": 264 | await message.reply_text(f"{hey}") 265 | 266 | 267 | @bot.on_message( 268 | ( 269 | filters.sticker 270 | | filters.text 271 | ) 272 | & filters.private 273 | & ~filters.bot, 274 | ) 275 | async def vickprivatesticker(client: Client, message: Message): 276 | 277 | chatdb = MongoClient(MONGO_URL) 278 | chatai = chatdb["Word"]["WordDb"] 279 | if not message.reply_to_message: 280 | await bot.send_chat_action(message.chat.id, "typing") 281 | K = [] 282 | is_chat = chatai.find({"word": message.sticker.file_unique_id}) 283 | for x in is_chat: 284 | K.append(x['text']) 285 | hey = random.choice(K) 286 | is_text = chatai.find_one({"text": hey}) 287 | Yo = is_text['check'] 288 | if Yo == "text": 289 | await message.reply_text(f"{hey}") 290 | if not Yo == "text": 291 | await message.reply_sticker(f"{hey}") 292 | if message.reply_to_message: 293 | getme = await bot.get_me() 294 | bot_id = getme.id 295 | if message.reply_to_message.from_user.id == bot_id: 296 | await bot.send_chat_action(message.chat.id, "typing") 297 | K = [] 298 | is_chat = chatai.find({"word": message.sticker.file_unique_id}) 299 | for x in is_chat: 300 | K.append(x['text']) 301 | hey = random.choice(K) 302 | is_text = chatai.find_one({"text": hey}) 303 | Yo = is_text['check'] 304 | if Yo == "text": 305 | await message.reply_text(f"{hey}") 306 | if not Yo == "text": 307 | await message.reply_sticker(f"{hey}") 308 | 309 | bot.run() 310 | --------------------------------------------------------------------------------