[V3] Set token command (#1425)

* [V3] Add set token command

* DM check

* warning message + delete if token isn't send in DM

* Update string formatting
This commit is contained in:
retke 2018-03-21 01:08:36 +01:00 committed by Kowlin
parent 27b61a2770
commit 749af89e9f

View File

@ -575,6 +575,27 @@ class Core:
else:
await ctx.send(_("Invalid token."))
@_set.command()
@checks.is_owner()
async def token(self, ctx, token: str):
"""Change bot token."""
if not not isinstance(ctx.channel, discord.DMChannel):
try:
await ctx.message.delete()
except discord.Forbidden:
pass
await ctx.send(
_("Please use that command in DM. Since users probably saw your token,"
" it is recommended to reset it right now. Go to the following link and"
" select `Reveal Token` and `Generate a new token?`."
"\n\nhttps://discordapp.com/developers/applications/me/{}").format(self.bot.user.id))
return
await ctx.bot.db.token.set(token)
await ctx.send("Token set. Restart me.")
@_set.command()
@checks.is_owner()
async def locale(self, ctx: commands.Context, locale_name: str):