mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[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:
parent
27b61a2770
commit
749af89e9f
@ -574,6 +574,27 @@ class Core:
|
|||||||
await ctx.send(_("You have been set as owner."))
|
await ctx.send(_("You have been set as owner."))
|
||||||
else:
|
else:
|
||||||
await ctx.send(_("Invalid token."))
|
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()
|
@_set.command()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user