コード例 #1
0
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)
コード例 #2
0
def mute(message):
    if not tools.ThinkerMSG(message):
        return
    kb = types.InlineKeyboardMarkup()
    callback_data = "ban_{}_{}".format(message.from_user.id, message.from_user.id)
    decline = "declineBan_{}_{}".format(message.from_user.id, message.from_user.id)
    kb.add(types.InlineKeyboardButton(text=lang["banme_accept_button_text"], callback_data=callback_data))
    kb.add(types.InlineKeyboardButton(text=lang["banme_decline_button_text"], callback_data=decline))
    bot.reply_to(message, lang["banme_accept_text"].format(tools.getName(message)), parse_mode=pmode, reply_markup=kb)
コード例 #3
0
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)
コード例 #4
0
def mute(message):
    if not tools.ThinkerMSG(message):
        return
    kb = types.InlineKeyboardMarkup()
    try:
        callback_data = "mute_{}_{}_{}".format(
            message.from_user.id, message.from_user.id,
                  tools.GetUnixDelta(message.text.split(" ", maxsplit=1)[1]))
        decline = "declineBan_{}_{}_{}".format(
            message.from_user.id, message.from_user.id,
                  tools.GetUnixDelta(message.text.split(" ", maxsplit=1)[1]))
    except:
        bot.reply_to(message, lang["muteme_error_parsing"], parse_mode=pmode)
        return
    kb.add(types.InlineKeyboardButton(text=lang["muteme_accept_button_text"], callback_data=callback_data))
    kb.add(types.InlineKeyboardButton(text=lang["muteme_decline_button_text"], callback_data=decline))
    bot.reply_to(message, lang["muteme_accept_text"].format(tools.getName(message)), parse_mode=pmode, reply_markup=kb)
コード例 #5
0
def onstart(message):
    if not tools.ThinkerMSG(message):
        return
    bot.reply_to(message, lang["id"].format(tools.getName(message), str(tools.getID(message))), parse_mode=pmode)