builtin.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:pcbot 作者: pckv 项目源码 文件源码
def setowner(message: discord.Message):
    """ Set the bot owner. Only works in private messages. """
    if not message.channel.is_private:
        return

    assert not plugins.owner_cfg.data, "An owner is already set."

    owner_code = str(random.randint(100, 999))
    logging.critical("Owner code for assignment: {}".format(owner_code))

    await client.say(message,
                     "A code has been printed in the console for you to repeat within 60 seconds.")
    user_code = await client.wait_for_message(timeout=60, channel=message.channel, content=owner_code)

    assert user_code, "You failed to send the desired code."

    if user_code:
        await client.say(message, "You have been assigned bot owner.")
        plugins.owner_cfg.data = message.author.id
        plugins.owner_cfg.save()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号