mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Core Commands] remove set owner and set token (#2928)
* remove set-owner and set token * whoops, wrong number on the changelog * whoops, git didnt detect the rename cause I didnt add the file
This commit is contained in:
parent
556af32bb5
commit
984a97d958
1
changelog.d/2928.removal.rst
Normal file
1
changelog.d/2928.removal.rst
Normal file
@ -0,0 +1 @@
|
||||
The ``set owner`` and ``set token`` commands have been removed in favor of managing server side.
|
||||
@ -1078,81 +1078,6 @@ class Core(commands.Cog, CoreLogic):
|
||||
await ctx.bot.db.guild(ctx.guild).prefix.set(prefixes)
|
||||
await ctx.send(_("Prefix set."))
|
||||
|
||||
@_set.command()
|
||||
@commands.cooldown(1, 60 * 10, commands.BucketType.default)
|
||||
async def owner(self, ctx: commands.Context):
|
||||
"""Sets Red's main owner"""
|
||||
# According to the Python docs this is suitable for cryptographic use
|
||||
random = SystemRandom()
|
||||
length = random.randint(25, 35)
|
||||
chars = ascii_letters + digits
|
||||
token = ""
|
||||
|
||||
for i in range(length):
|
||||
token += random.choice(chars)
|
||||
log.info(_("{0} ({0.id}) requested to be set as owner.").format(ctx.author))
|
||||
print(_("\nVerification token:"))
|
||||
print(token)
|
||||
|
||||
owner_disclaimer = _(
|
||||
"⚠ **Only** the person who is hosting Red should be "
|
||||
"owner. **This has SERIOUS security implications. The "
|
||||
"owner can access any data that is present on the host "
|
||||
"system.** ⚠"
|
||||
)
|
||||
await ctx.send(_("Remember:\n") + owner_disclaimer)
|
||||
await asyncio.sleep(5)
|
||||
|
||||
await ctx.send(
|
||||
_(
|
||||
"I have printed a one-time token in the console. "
|
||||
"Copy and paste it here to confirm you are the owner."
|
||||
)
|
||||
)
|
||||
|
||||
try:
|
||||
message = await ctx.bot.wait_for(
|
||||
"message", check=MessagePredicate.same_context(ctx), timeout=60
|
||||
)
|
||||
except asyncio.TimeoutError:
|
||||
ctx.command.reset_cooldown(ctx)
|
||||
await ctx.send(
|
||||
_("The `{prefix}set owner` request has timed out.").format(prefix=ctx.prefix)
|
||||
)
|
||||
else:
|
||||
if message.content.strip() == token:
|
||||
ctx.command.reset_cooldown(ctx)
|
||||
await ctx.bot.db.owner.set(ctx.author.id)
|
||||
ctx.bot.owner_id = ctx.author.id
|
||||
await ctx.send(_("You have been set as owner."))
|
||||
else:
|
||||
await ctx.send(_("Invalid token."))
|
||||
|
||||
@_set.command()
|
||||
@checks.is_owner()
|
||||
async def token(self, ctx: commands.Context, token: str):
|
||||
"""Change bot token."""
|
||||
|
||||
if 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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user