-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmain.py
344 lines (302 loc) · 12.4 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
from pyrogram import Client, filters
from pyrogram.types import *
from pymongo import MongoClient
import requests
import random
import os
import re
API_ID = os.environ.get("API_ID", None)
API_HASH = os.environ.get("API_HASH", None)
BOT_TOKEN = os.environ.get("BOT_TOKEN", None)
MONGO_URL = os.environ.get("MONGO_URL", None)
bot = Client(
"VickBot" ,
api_id = API_ID,
api_hash = API_HASH ,
bot_token = BOT_TOKEN
)
async def is_admins(chat_id: int):
return [
member.user.id
async for member in bot.iter_chat_members(
chat_id, filter="administrators"
)
]
@bot.on_message(filters.command("start"))
async def start(client, message):
self = await bot.get_me()
busername = self.username
if message.chat.type != "private":
buttons = [
[
InlineKeyboardButton("ᴜᴘᴅᴀᴛᴇs", url="https://t.me/BRANDRD_BOT"),
InlineKeyboardButton("sᴜᴘᴘᴏʀᴛ", url="https://t.me/BRANDED_WORLD"),
]
]
await message.reply("ᴄᴏɴᴛᴀᴄᴛ ᴍᴇ ɪɴ ᴘᴇʀsᴏɴᴀʟ",
reply_markup=buttons)
else:
buttons = [[
InlineKeyboardButton("❮ ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘ ❯", url=f"https://t.me/VickMachine82_Bot?startgroup=true")
]
]
video = "https://graph.org/file/e999c40cb700e7c684b75.mp4"
await message.reply_video(video, caption=f"""ʜᴇʟʟᴏ[{message.from_user.first_name}](tg://user?id={message.from_user.id}),
ɪ ᴀᴍ ᴄʜᴀᴛʙᴏᴛ ғᴏʀ ᴛᴇʟᴇɢʀᴀᴍ ɢʀᴏᴜᴘs ...
┏━━━━━━━━━━━━━━━━━┓
┣★ 𝐎𝐖𝐍𝐄𝐑 [𝐀𝐃𝐈𝐓𝐘𝐀](https://t.me/BRANDEDADITY82)
┣★ 𝐔𝐏𝐃𝐀𝐓𝐄𝐒 [𝐂𝐇𝐀𝐍𝐍𝐄𝐋](https://t.me/BRANDRD_BOT)
┣★ 𝐒𝐔𝐏𝐏𝐎𝐑𝐓 [𝐆𝐑𝐎𝐔𝐏](https://t.me/BRANDED_WORLD)
┣★ 𝐒𝐎𝐔𝐑𝐂𝐄 [ 𝐑𝐄𝐏𝐎](https://github.com/ADITYAXANLO/VICKCHATBOT)
┗━━━━━━━━━━━━━━━━━┛
""", reply_markup=InlineKeyboardMarkup(buttons))
@bot.on_message(
filters.command("chatbot off", prefixes=["/", ".", "?", "-"])
& ~filters.private)
async def chatbotofd(client, message):
vickdb = MongoClient(MONGO_URL)
vick = vickdb["VickDb"]["Vick"]
if message.from_user:
user = message.from_user.id
chat_id = message.chat.id
if user not in (
await is_admins(chat_id)
):
return await message.reply_text(
"You are not admin"
)
is_vick = vick.find_one({"chat_id": message.chat.id})
if not is_vick:
vick.insert_one({"chat_id": message.chat.id})
await message.reply_text(f"Chatbot Disabled!")
if is_vick:
await message.reply_text(f"ChatBot Is Already Disabled")
@bot.on_message(
filters.command("chatbot on", prefixes=["/", ".", "?", "-"])
& ~filters.private)
async def chatboton(client, message):
vickdb = MongoClient(MONGO_URL)
vick = vickdb["VickDb"]["Vick"]
if message.from_user:
user = message.from_user.id
chat_id = message.chat.id
if user not in (
await is_admins(chat_id)
):
return await message.reply_text(
"You are not admin"
)
is_vick = vick.find_one({"chat_id": message.chat.id})
if not is_vick:
await message.reply_text(f"Chatbot Is Already Enabled")
if is_vick:
vick.delete_one({"chat_id": message.chat.id})
await message.reply_text(f"ChatBot Is Enable!")
@bot.on_message(
filters.command("chatbot", prefixes=["/", ".", "?", "-"])
& ~filters.private)
async def chatbot(client, message):
await message.reply_text(f"**Usage:**\n/chatbot [on|off] only group")
@bot.on_message(
(
filters.text
| filters.sticker
)
& ~filters.private
& ~filters.bot,
)
async def vickai(client: Client, message: Message):
chatdb = MongoClient(MONGO_URL)
chatai = chatdb["Word"]["WordDb"]
if not message.reply_to_message:
vickdb = MongoClient(MONGO_URL)
vick = vickdb["VickDb"]["Vick"]
is_vick = vick.find_one({"chat_id": message.chat.id})
if not is_vick:
await bot.send_chat_action(message.chat.id, "typing")
K = []
is_chat = chatai.find({"word": message.text})
k = chatai.find_one({"word": message.text})
if k:
for x in is_chat:
K.append(x['text'])
hey = random.choice(K)
is_text = chatai.find_one({"text": hey})
Yo = is_text['check']
if Yo == "sticker":
await message.reply_sticker(f"{hey}")
if not Yo == "sticker":
await message.reply_text(f"{hey}")
if message.reply_to_message:
vickdb = MongoClient(MONGO_URL)
vick = vickdb["VickDb"]["Vick"]
is_vick = vick.find_one({"chat_id": message.chat.id})
getme = await bot.get_me()
bot_id = getme.id
if message.reply_to_message.from_user.id == bot_id:
if not is_vick:
await bot.send_chat_action(message.chat.id, "typing")
K = []
is_chat = chatai.find({"word": message.text})
k = chatai.find_one({"word": message.text})
if k:
for x in is_chat:
K.append(x['text'])
hey = random.choice(K)
is_text = chatai.find_one({"text": hey})
Yo = is_text['check']
if Yo == "sticker":
await message.reply_sticker(f"{hey}")
if not Yo == "sticker":
await message.reply_text(f"{hey}")
if not message.reply_to_message.from_user.id == bot_id:
if message.sticker:
is_chat = chatai.find_one({"word": message.reply_to_message.text, "id": message.sticker.file_unique_id})
if not is_chat:
chatai.insert_one({"word": message.reply_to_message.text, "text": message.sticker.file_id, "check": "sticker", "id": message.sticker.file_unique_id})
if message.text:
is_chat = chatai.find_one({"word": message.reply_to_message.text, "text": message.text})
if not is_chat:
chatai.insert_one({"word": message.reply_to_message.text, "text": message.text, "check": "none"})
@bot.on_message(
(
filters.sticker
| filters.text
)
& ~filters.private
& ~filters.bot,
)
async def vickstickerai(client: Client, message: Message):
chatdb = MongoClient(MONGO_URL)
chatai = chatdb["Word"]["WordDb"]
if not message.reply_to_message:
vickdb = MongoClient(MONGO_URL)
vick = vickdb["VickDb"]["Vick"]
is_vick = vick.find_one({"chat_id": message.chat.id})
if not is_vick:
await bot.send_chat_action(message.chat.id, "typing")
K = []
is_chat = chatai.find({"word": message.sticker.file_unique_id})
k = chatai.find_one({"word": message.text})
if k:
for x in is_chat:
K.append(x['text'])
hey = random.choice(K)
is_text = chatai.find_one({"text": hey})
Yo = is_text['check']
if Yo == "text":
await message.reply_text(f"{hey}")
if not Yo == "text":
await message.reply_sticker(f"{hey}")
if message.reply_to_message:
vickdb = MongoClient(MONGO_URL)
vick = vickdb["VickDb"]["Vick"]
is_vick = vick.find_one({"chat_id": message.chat.id})
getme = await bot.get_me()
bot_id = getme.id
if message.reply_to_message.from_user.id == bot_id:
if not is_vick:
await bot.send_chat_action(message.chat.id, "typing")
K = []
is_chat = chatai.find({"word": message.text})
k = chatai.find_one({"word": message.text})
if k:
for x in is_chat:
K.append(x['text'])
hey = random.choice(K)
is_text = chatai.find_one({"text": hey})
Yo = is_text['check']
if Yo == "text":
await message.reply_text(f"{hey}")
if not Yo == "text":
await message.reply_sticker(f"{hey}")
if not message.reply_to_message.from_user.id == bot_id:
if message.text:
is_chat = chatai.find_one({"word": message.reply_to_message.sticker.file_unique_id, "text": message.text})
if not is_chat:
toggle.insert_one({"word": message.reply_to_message.sticker.file_unique_id, "text": message.text, "check": "text"})
if message.sticker:
is_chat = chatai.find_one({"word": message.reply_to_message.sticker.file_unique_id, "text": message.sticker.file_id})
if not is_chat:
chatai.insert_one({"word": message.reply_to_message.sticker.file_unique_id, "text": message.sticker.file_id, "check": "none"})
@bot.on_message(
(
filters.text
| filters.sticker
)
& filters.private
& ~filters.bot,
)
async def vickprivate(client: Client, message: Message):
chatdb = MongoClient(MONGO_URL)
chatai = chatdb["Word"]["WordDb"]
if not message.reply_to_message:
await bot.send_chat_action(message.chat.id, "typing")
K = []
is_chat = chatai.find({"word": message.text})
for x in is_chat:
K.append(x['text'])
hey = random.choice(K)
is_text = chatai.find_one({"text": hey})
Yo = is_text['check']
if Yo == "sticker":
await message.reply_sticker(f"{hey}")
if not Yo == "sticker":
await message.reply_text(f"{hey}")
if message.reply_to_message:
getme = await bot.get_me()
bot_id = getme.id
if message.reply_to_message.from_user.id == bot_id:
await bot.send_chat_action(message.chat.id, "typing")
K = []
is_chat = chatai.find({"word": message.text})
for x in is_chat:
K.append(x['text'])
hey = random.choice(K)
is_text = chatai.find_one({"text": hey})
Yo = is_text['check']
if Yo == "sticker":
await message.reply_sticker(f"{hey}")
if not Yo == "sticker":
await message.reply_text(f"{hey}")
@bot.on_message(
(
filters.sticker
| filters.text
)
& filters.private
& ~filters.bot,
)
async def vickprivatesticker(client: Client, message: Message):
chatdb = MongoClient(MONGO_URL)
chatai = chatdb["Word"]["WordDb"]
if not message.reply_to_message:
await bot.send_chat_action(message.chat.id, "typing")
K = []
is_chat = chatai.find({"word": message.sticker.file_unique_id})
for x in is_chat:
K.append(x['text'])
hey = random.choice(K)
is_text = chatai.find_one({"text": hey})
Yo = is_text['check']
if Yo == "text":
await message.reply_text(f"{hey}")
if not Yo == "text":
await message.reply_sticker(f"{hey}")
if message.reply_to_message:
getme = await bot.get_me()
bot_id = getme.id
if message.reply_to_message.from_user.id == bot_id:
await bot.send_chat_action(message.chat.id, "typing")
K = []
is_chat = chatai.find({"word": message.sticker.file_unique_id})
for x in is_chat:
K.append(x['text'])
hey = random.choice(K)
is_text = chatai.find_one({"text": hey})
Yo = is_text['check']
if Yo == "text":
await message.reply_text(f"{hey}")
if not Yo == "text":
await message.reply_sticker(f"{hey}")
bot.run()