-
Notifications
You must be signed in to change notification settings - Fork 0
/
echo.py
33 lines (24 loc) · 1.16 KB
/
echo.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
from .. import loader
@loader.tds
class EchoMod(loader.Module):
"""Эхо модуль."""
strings = {'name': 'Echo'}
async def client_ready(self, client, db):
self.db = db
async def echocmd(self, message):
"""Активировать/деактивировать Echo."""
echos = self.db.get("Echo", "chats", [])
chatid = str(message.chat_id)
if chatid not in echos:
echos.append(chatid)
self.db.set("Echo", "chats", echos)
return await message.edit("<b>[Echo Mode]</b> Активирован в этом чате!")
echos.remove(chatid)
self.db.set("Echo", "chats", echos)
return await message.edit("<b>[Echo Mode]</b> Деактивирован в этом чате!")
async def watcher(self, message):
echos = self.db.get("Echo", "chats", [])
chatid = str(message.chat_id)
if chatid not in str(echos): return
if message.sender_id == (await message.client.get_me()).id: return
await message.client.send_message(int(chatid), message, reply_to=await message.get_reply_message() or message)