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()
评论列表
文章目录