INNER CODE UNIT · Python

authorize

TechXueXi/TechXueXi · SourcePackages/telegramListener.py:16

def authorize(self):
    """
    验证消息人,防止个人信息泄露
    """
    return str(self.from_user.id) == master


@bot.message_handler(commands=['start'], func=authorize)
def send_welcome(message):
    bot.reply_to(message, "一起来学xi吧!\n输入 /help 获取帮助。")


@bot.message_handler(commands=['help'], func=authorize)
def get_help(message):
    bot.reply_to(message,
                 "/help 获取帮助\n" +
                 "/learn 开始学习, /learn 张三 指定账号学习\n" +
                 "/list 获取账号列表\n" +

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…