-
Notifications
You must be signed in to change notification settings - Fork 53
/
AlexaAi.py
351 lines (321 loc) · 13.8 KB
/
AlexaAi.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
345
346
347
348
349
350
351
# © - MetaVoid (Moezilla) And Alexa Team For Modification
# Give Credit ❣️Day
from pyrogram import Client, filters
import asyncio
from pyrogram.types import *
from pymongo import MongoClient
import requests
import random
from pyrogram.errors import (
PeerIdInvalid,
ChatWriteForbidden
)
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message
from pyrogram.errors import ChatAdminRequired, UserNotParticipant, ChatWriteForbidden
from os import getenv
import re
from dotenv import load_dotenv
load_dotenv()
API_ID = int(getenv("API_ID", ""))
API_HASH = getenv("API_HASH")
SESSION_NAME = getenv("SESSION_NAME", None)
MONGO_URL = getenv("MONGO_URL", None)
client = Client(SESSION_NAME, API_ID, API_HASH)
async def is_admins(chat_id: int):
return [
member.user.id
async for member in client.iter_chat_members(
chat_id, filter="administrators"
)
]
@client.on_message(
filters.command("repo", prefixes=["/", ".", "?", "-"])
& ~filters.private)
async def chatbot(client, message):
await message.delete()
alexaai = await message.reply("🤭🤏✌️")
await asyncio.sleep(1)
await alexaai.edit("**ʙᴏʜᴀᴛ ᴛᴀɪᴊ ʜᴏ ʀᴇᴘᴏ ᴄʜᴀʜɪʏᴇ**")
await asyncio.sleep(1)
await alexaai.edit("**ɪ ᴀᴍ ᴅᴏɪɴɢ ᴍʏ ʟᴏᴠᴇ 💕**")
await alexaai.delete()
await asyncio.sleep(2)
umm = await message.reply_sticker("CAACAgIAAxkBAAEForNjAykaq_efq4Wd-9KZv-nNxJRn3AACIgMAAm2wQgO8x8PfoXC1eCkE")
await asyncio.sleep(2)
await message.reply_photo(
photo=f"https://telegra.ph/file/2fabd1c33e888e0533891.jpg",
caption=f"""━━━━━━━━━━━━━━━━━━━━━━━━
💥 A ᴘᴏᴡᴇʀғᴜʟ ᴀɪ ʙᴏᴛ
ᴏғ ♻️ ᴅʀ ᴀsᴀᴅ ᴀʟɪ 🔥
━━━━━━━━━━━━━━━━━
ᴅᴀᴛᴀʙᴀsᴇ ʙᴀᴄᴋᴇɴᴅ ʙᴏᴛ ғᴏʀ ᴛɢ...
┏━━━━━━━━━━━━━━━━━┓
┣★ ᴄʀᴇᴀᴛᴇʀ [ᴀsᴀᴅ ᴀʟɪ](https://t.me/Dr_Asad_Ali)
┣★ ʜᴇᴀʀᴛ ᴜs [ʜᴇᴀʀᴛ ❤️](https://t.me/Give_Me_Heart)
┣★ ʙᴏᴛ ᴜᴘᴅᴀᴛᴇs [ᴏᴜʀ ᴏᴛʜᴇʀ ʙᴏᴛs](https://t.me/AsadSupport)
┣★ ᴀʟᴇxᴀ ғᴇᴅ [ғᴇᴅ ʟᴏɢs](https://t.me/AlexaFed_Logs)
┣★ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ : [ᴄʟɪᴄᴋ ʜᴇʀᴇ](https://github.com/TheTeamAlexa/AlexaAiMachineBot)
┣★ ɴᴇᴛᴡᴏʀᴋ [ʀᴏᴄᴋs](https://t.me/Shayri_Music_Lovers)
┗━━━━━━━━━━━━━━━━━┛
💞
IF HAVE ANY QUESTION THEN CONTACT » TO » MY » [OWNER] @Jankari_Ki_Duniya""",
)
@client.on_message(
filters.command("alive", prefixes=["/", ".", "?", "-"])
& ~filters.private)
async def start(client, message):
await message.reply_text(f"**ᴀʟᴇxᴀ ᴀɪ ᴜsᴇʀʙᴏᴛ ғᴏʀ ᴄʜᴀᴛᴛɪɴɢ ɪs ᴡᴏʀᴋɪɴɢ**")
@client.on_message(
filters.command("chatbot off", prefixes=["/", ".", "?", "-"])
& ~filters.private)
async def chatbotofd(client, message):
alexadb = MongoClient(MONGO_URL)
alexa = alexadb["AlexaDb"]["Alexa"]
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(
""
)
is_alexa = alexa.find_one({"chat_id": message.chat.id})
if not is_alexa:
alexa.insert_one({"chat_id": message.chat.id})
await message.reply_text(f"ᴄʜᴀᴛʙɪᴛ ɪs ᴅɪsᴀʙʟᴇᴅ ʙʏ {message.from_user.mention()} ғᴏʀ ᴜsᴇʀs ɪɴ {message.chat.title}")
if is_alexa:
await message.reply_text(f"ᴄʜᴀᴛʙɪᴛ ɪs ᴀʟʀᴇᴀᴅʏ ᴅɪsᴀʙʟᴇᴅ")
@client.on_message(
filters.command("chatbot on", prefixes=["/", ".", "?", "-"])
& ~filters.private)
async def chatboton(client, message):
alexadb = MongoClient(MONGO_URL)
alexa = alexadb["AlexaDb"]["Alexa"]
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(
"ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ"
)
is_alexa = alexa.find_one({"chat_id": message.chat.id})
if not is_alexa:
await message.reply_text(f"ᴄʜᴀᴛʙɪᴛ ɪs ᴀʟʀᴇᴀᴅʏ ᴇɴᴀʙʟᴇᴅ")
if is_alexa:
alexa.delete_one({"chat_id": message.chat.id})
await message.reply_text(f"ᴄʜᴀᴛʙɪᴛ ɪs ᴇɴᴀʙʟᴇᴅ ʙʏ {message.from_user.mention()} ғᴏʀ ᴜsᴇʀs ɪɴ {message.chat.title}")
@client.on_message(
filters.command("chatbot", prefixes=["/", ".", "?", "-"])
& ~filters.private)
async def chatbot(client, message):
await message.reply_text(f"**ᴜsᴇᴀɢᴇ:**\n/chatbot [on|off] ᴏɴʟʏ ɢʀᴏᴜᴘ")
@client.on_message(
(
filters.text
| filters.sticker
)
& ~filters.private
& ~filters.me
& ~filters.bot,
)
async def alexaai(client: Client, message: Message):
chatdb = MongoClient(MONGO_URL)
chatai = chatdb["Word"]["WordDb"]
if not message.reply_to_message:
alexadb = MongoClient(MONGO_URL)
alexa = alexadb["AlexaDb"]["Alexa"]
is_alexa = alexa.find_one({"chat_id": message.chat.id})
if not is_alexa:
await client.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:
alexadb = MongoClient(MONGO_URL)
alexa = alexadb["AlexaDb"]["Alexa"]
is_alexa = alexa.find_one({"chat_id": message.chat.id})
getme = await client.get_me()
user_id = getme.id
if message.reply_to_message.from_user.id == user_id:
if not is_alexa:
await client.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 == user_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"})
@client.on_message(
(
filters.sticker
| filters.text
)
& ~filters.private
& ~filters.me
& ~filters.bot,
)
async def alexastickerai(client: Client, message: Message):
chatdb = MongoClient(MONGO_URL)
chatai = chatdb["Word"]["WordDb"]
if not message.reply_to_message:
alexadb = MongoClient(MONGO_URL)
alexa = alexadb["AlexaDb"]["Alexa"]
is_alexa = alexa.find_one({"chat_id": message.chat.id})
if not is_alexa:
await client.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:
alexadb = MongoClient(MONGO_URL)
alexa = alexadb["AlexaDb"]["Alexa"]
is_alexa = alexa.find_one({"chat_id": message.chat.id})
getme = await client.get_me()
user_id = getme.id
if message.reply_to_message.from_user.id == user_id:
if not is_alexa:
await client.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 == user_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"})
@client.on_message(
(
filters.text
| filters.sticker
)
& filters.private
& ~filters.me
& ~filters.bot,
)
async def alexaprivate(client: Client, message: Message):
chatdb = MongoClient(MONGO_URL)
chatai = chatdb["Word"]["WordDb"]
if not message.reply_to_message:
await client.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 client.get_me()
user_id = getme.id
if message.reply_to_message.from_user.id == user_id:
await client.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}")
@client.on_message(
(
filters.sticker
| filters.text
)
& filters.private
& ~filters.me
& ~filters.bot,
)
async def alexaprivatesticker(client: Client, message: Message):
chatdb = MongoClient(MONGO_URL)
chatai = chatdb["Word"]["WordDb"]
if not message.reply_to_message:
await client.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 client.get_me()
user_id = getme.id
if message.reply_to_message.from_user.id == user_id:
await client.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}")
client.run()