async def _(event): if event.fwd_from: return warn_reason = event.pattern_match.group(1) reply_message = await event.get_reply_message() limit, soft_warn = sql.get_warn_setting(event.chat_id) num_warns, reasons = sql.warn_user(reply_message.from_id, event.chat_id, warn_reason) if num_warns >= limit: sql.reset_warns(reply_message.from_id, event.chat_id) if soft_warn: logger.info("TODO: kick user") reply = "{} warnings, <u><a href='tg://user?id={}'>user</a></u> has been kicked!".format( limit, reply_message.from_id) else: logger.info("TODO: ban user") reply = "{} warnings, <u><a href='tg://user?id={}'>user</a></u> has been banned!".format( limit, reply_message.from_id) else: reply = "<u><a href='tg://user?id={}'>user</a></u> has {}/{} warnings... watch out!".format( reply_message.from_id, num_warns, limit) if warn_reason: reply += "\nReason for last warn:\n{}".format( html.escape(warn_reason)) await edit_or_reply(event, reply, parse_mode="html")
async def _(event): if event.fwd_from: return warn_reason = event.pattern_match.group(1) if not warn_reason: warn_reason = "No reason" reply_message = await event.get_reply_message() limit, soft_warn = sql.get_warn_setting(event.chat_id) num_warns, reasons = sql.warn_user(reply_message.sender_id, event.chat_id, warn_reason) if num_warns >= limit: sql.reset_warns(reply_message.sender_id, event.chat_id) if soft_warn: logger.info("TODO: kick user") reply = "{} warnings, [user](tg://user?id={}) has to bee kicked!".format( limit, reply_message.sender_id) else: logger.info("TODO: ban user") reply = "{} warnings, [user](tg://user?id={}) has to bee banned!".format( limit, reply_message.sender_id) else: reply = "[user](tg://user?id={}) has {}/{} warnings... watch out!".format( reply_message.sender_id, num_warns, limit) if warn_reason: reply += "\nReason for last warn:\n{}".format( html.escape(warn_reason)) await edit_or_reply(event, reply)
async def _(event): if event.fwd_from: return warn_reason = event.pattern_match.group(1) reply_message = await event.get_reply_message() limit, soft_warn = sql.get_warn_setting(event.chat_id) num_warns, reasons = sql.warn_user( reply_message.from_id, event.chat_id, warn_reason) if num_warns >= limit: sql.reset_warns(reply_message.from_id, event.chat_id) if soft_warn: logger.info("Yapılacaklar: Kullanıcıyı at") reply = "{} dikkat, <u><a href='tg://user?id={}'>user</a></u> atıldı!".format( limit, reply_message.from_id) else: logger.info("Yapılacaklar: Kullanıcıyı yasakla") reply = "{} dikkat, <u><a href='tg://user?id={}'>user</a></u> yasaklandı!".format( limit, reply_message.from_id) else: reply = "<u><a href='tg://user?id={}'>user</a></u> has {}/{} uyarılar... dikkat et!".format( reply_message.from_id, num_warns, limit) if warn_reason: reply += "\nSon uyarı ve sebebi:\n{}".format( html.escape(warn_reason)) await edit_or_reply(event, reply, parse_mode="html")