"on": True, "data": REASON, "time": TIME }}, upsert=True, ), ) @userge.on_filters( IS_AFK_FILTER & ~filters.me & ~filters.bot & ~filters.user(Config.TG_IDS) & ~filters.edited & ~filters.chat(-1001496700428) & (filters.mentioned | (filters.private & ~filters.service)), allow_via_bot=False, ) async def handle_afk_incomming(message: Message) -> None: """handle incomming messages when you afk""" if not message.from_user: return user_id = message.from_user.id chat = message.chat user_dict = await message.client.get_user_dict(user_id) afk_time = time_formatter(round(time.time() - TIME)) coro_list = [] if user_id in USERS: if not (USERS[user_id][0] + USERS[user_id][1]) % randint(2, 4): if REASON:
""" auto welcome and left messages """ import asyncio from pyrogram.errors import FloodWait from userge import Config, Message, filters, get_collection, userge WELCOME_COLLECTION = get_collection("welcome") LEFT_COLLECTION = get_collection("left") WELCOME_CHATS = filters.chat([]) LEFT_CHATS = filters.chat([]) CHANNEL = userge.getCLogger(__name__) async def _init() -> None: async for i in WELCOME_COLLECTION.find({"on": True}): if "mid" not in i: continue WELCOME_CHATS.add(i.get("_id")) async for i in LEFT_COLLECTION.find({"on": True}): if "mid" not in i: continue LEFT_CHATS.add(i.get("_id")) @userge.on_cmd( "setwelcome", about={ "header": "Creates a welcome message in current chat",
from userge import userge, Message, filters LOG = userge.getLogger(__name__) CHANNEL = userge.getCLogger(__name__) AFK = [] FIX = "" FK = "" CHAT = [-1001199769918, -1001360580171, -1001486172777] # rdl WW = [1029642148, 980444671, 618096097, 175844556, 738172950, 1569645653] # werewolf bots @userge.on_filters( ( filters.chat(CHAT) & filters.user(WW) & filters.regex("Tempo total do jogo|Duração da partida") ) ) async def auto_fk(message: Message): global AFK global FK if await is_sr(message): FK = "" return lines = message.text lines_count = len(lines.split("\n\n")[0].split("\n")) - 1 info = await userge.send_message(message.chat.id, "Obtendo FK.") try: deads = await build_list(lines)