def mute(message): if not tools.ThinkerMSG(message): return if not tools.CheckAdmin(message, bot): bot.reply_to(message, lang["not_admin"], parse_mode=pmode) else: if message.reply_to_message == None: bot.reply_to(message, lang["mute_error_args"], parse_mode=pmode) return if message.reply_to_message.from_user.id == message.from_user.id: bot.reply_to(message, lang["mute_error_same_users"], parse_mode=pmode) return if message.reply_to_message.from_user.id == myid: bot.reply_to(message, lang["mute_error_bot"], parse_mode=pmode) return kb = types.InlineKeyboardMarkup() try: callback_data = "mute_{}_{}_{}".format( str(message.reply_to_message.from_user.id), message.from_user.id, tools.GetUnixDelta(message.text.split(" ", maxsplit=1)[1])) decline = "declineBan_{}_{}_{}".format( str(message.reply_to_message.from_user.id), message.from_user.id, tools.GetUnixDelta(message.text.split(" ", maxsplit=1)[1])) except: bot.reply_to(message, lang["mute_error_parsing"], parse_mode=pmode) return kb.add(types.InlineKeyboardButton(text=lang["mute_accept_button_text"], callback_data=callback_data)) kb.add(types.InlineKeyboardButton(text=lang["mute_decline_button_text"], callback_data=decline)) bot.reply_to(message, lang["mute_accept_text"].format(tools.getName(message)), parse_mode=pmode, reply_markup=kb)
def onstart(message): if not tools.ThinkerMSG(message) and message.chat.title == None: return if not tools.CheckAdmin(message, bot): bot.reply_to(message, lang["not_admin"], parse_mode=pmode) else: if tools.WelcomeCommand(message): bot.reply_to(message, lang["enabled"], parse_mode=pmode) else: bot.reply_to(message, lang["disabled"], parse_mode=pmode)
def onkick(message): if not tools.ThinkerMSG(message): return if message.reply_to_message == None: bot.reply_to(message, lang["del_error_arguments"], parse_mode=pmode) return if not tools.CheckAdmin(message, bot): bot.reply_to(message, lang["not_admin"], parse_mode=pmode) else: bot.delete_message(message.chat.id, message.reply_to_message.message_id)
def mute(message): if not tools.ThinkerMSG(message): return if not tools.CheckAdmin(message, bot): bot.reply_to(message, lang["not_admin"], parse_mode=pmode) else: if message.reply_to_message == None: bot.reply_to(message, lang["unmute_error_args"], parse_mode=pmode) return kb = types.InlineKeyboardMarkup() callback_data = "unmute_{}_{}".format(str(message.reply_to_message.from_user.id), message.from_user.id) decline = "declineUnmute_{}_{}".format(str(message.reply_to_message.from_user.id), message.from_user.id) kb.add(types.InlineKeyboardButton(text=lang["unmute_accept_button_text"], callback_data=callback_data)) kb.add(types.InlineKeyboardButton(text=lang["unmute_decline_button_text"], callback_data=decline)) bot.reply_to(message, lang["unmute_accept_text"].format(tools.getName(message)), parse_mode=pmode, reply_markup=kb)
def onstart(message): if not tools.ThinkerMSG(message) or message.chat.title == None: return if not tools.CheckAdmin(message, bot): bot.reply_to(message, lang["not_admin"], parse_mode=pmode) else: try: std = '' std = message.text.replace('/setrules{} '.format(config.botID), '').replace('/setrules{}',format(config.botID), "") std = std.replace('/setrules ', '').replace("/setrules", "") tools.setRules(message, std) bot.reply_to(message, lang["setrules_success"], parse_mode=pmode) except Exception as e: bot.reply_to(message, lang["error_to_user"], parse_mode=pmode) bot.send_message(config.logchannel, lang["error_to_log"].format(str(e)), parse_mode=pmode)
def onstart(message): if not tools.ThinkerMSG(message): return if not tools.CheckAdmin(message, bot): bot.reply_to(message, lang["not_admin"], parse_mode=pmode) else: try: std = '' if message.text.startswith('/setwelcome{}'.format(config.botID)): std = message.text.replace('/setwelcome{} '.format(config.botID), '').replace('/setwelcome{}',format(config.botID), "") elif message.text.startswith('/setwelcome'): std = message.text.replace('/setwelcome ', '').replace("/setwelcome", "") tools.setWelcome(message, std) bot.reply_to(message, lang["setwelcome_success"], parse_mode=pmode) except Exception as e: bot.reply_to(message, lang["error_to_user"], parse_mode=pmode) bot.send_message(config.logchannel, lang["error_to_log"].format(str(e)), parse_mode=pmode)