- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
import logging
import requests
from .. import loader, utils
logger = logging.getLogger(__name__)
def register(cb):
cb(TagallMod())
def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i:i + n]
class TagallMod(loader.Module):
strings = {"name": "Tagall"}
def __init__(self):
self.config = loader.ModuleConfig("DEFAULT_MENTION_MESSAGE", "Привет", "Default message of mentions")
self.name = self.strings["name"]
async def client_ready(self, client, db):
self.client = client
async def tagallcmd(self, message):
arg = utils.get_args_raw(message)
logger.error(message)
notifies = []
async for user in self.client.iter_participants(message.to_id):
notifies.append("<a href=\"tg://user?id="+ str(user.id) +"\">\u206c\u206f</a>")
chunkss = list(chunks(notifies, 10))
logger.error(chunkss)
await message.delete()
for chunk in chunkss:
await self.client.send_message(message.to_id, (self.config["DEFAULT_MENTION_MESSAGE"] if not arg else arg) + '\u206c\u206f'.join(chunk))