def log_user(update, context): chat = update.effective_chat # type: Optional[Chat] msg = update.effective_message # type: Optional[Message] """text = msg.text if msg.text else "" uid = msg.from_user.id uname = msg.from_user.name print("{} | {} | {} | {}".format(text, uname, uid, chat.title))""" fed_id = fedsql.get_fed_id(chat.id) if fed_id: user = update.effective_user if user: fban, fbanreason, fbantime = fedsql.get_fban_user(fed_id, user.id) if fban: send_message( update.effective_message, languages.tl( update.effective_message, "Pengguna ini dilarang di federasi saat ini!\nAlasan: `{}`" ).format(fbanreason), parse_mode="markdown") try: context.bot.kick_chat_member(chat.id, user.id) except: print("Fban: cannot banned this user") sql.update_user(msg.from_user.id, msg.from_user.username, chat.id, chat.title) if msg.reply_to_message: sql.update_user(msg.reply_to_message.from_user.id, msg.reply_to_message.from_user.username, chat.id, chat.title) if msg.forward_from: sql.update_user(msg.forward_from.id, msg.forward_from.username)
def log_user(bot: Bot, update: Update): chat = update.effective_chat # type: Optional[Chat] msg = update.effective_message # type: Optional[Message] fed_id = fedsql.get_fed_id(chat.id) if fed_id: user = update.effective_user if user: fban, fbanreason, fbantime = fedsql.get_fban_user(fed_id, user.id) if fban: update.effective_message.reply_text(languages.tl(update.effective_message, "Pengguna ini dilarang di federasi saat ini!\nAlasan: `{}`").format(fbanreason), parse_mode="markdown") try: bot.kick_chat_member(chat.id, user.id) except: print("Fban: cannot banned this user") sql.update_user(msg.from_user.id, msg.from_user.username, chat.id, chat.title) if msg.reply_to_message: sql.update_user(msg.reply_to_message.from_user.id, msg.reply_to_message.from_user.username, chat.id, chat.title) if msg.forward_from: sql.update_user(msg.forward_from.id, msg.forward_from.username)
def log_user(bot: Bot, update: Update): chat = update.effective_chat # type: Optional[Chat] msg = update.effective_message # type: Optional[Message] sql.update_user(msg.from_user.id, msg.from_user.username, chat.id, chat.title) if msg.reply_to_message: sql.update_user(msg.reply_to_message.from_user.id, msg.reply_to_message.from_user.username, chat.id, chat.title) if msg.forward_from: sql.update_user(msg.forward_from.id, msg.forward_from.username)