mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-08 20:28:55 -05:00
Remove self-bot support (#2008)
This commit is contained in:
parent
bc39a6741c
commit
6ebfdef025
@ -158,14 +158,9 @@ def main():
|
||||
if tmp_data["enable_sentry"]:
|
||||
red.enable_sentry()
|
||||
try:
|
||||
loop.run_until_complete(red.start(token, bot=not cli_flags.not_bot))
|
||||
loop.run_until_complete(red.start(token, bot=True))
|
||||
except discord.LoginFailure:
|
||||
log.critical(
|
||||
"This token doesn't seem to be valid. If it belongs to "
|
||||
"a user account, remember that the --not-bot flag "
|
||||
"must be used. For self-bot functionalities instead, "
|
||||
"--self-bot"
|
||||
)
|
||||
log.critical("This token doesn't seem to be valid.")
|
||||
db_token = loop.run_until_complete(red.db.token())
|
||||
if db_token and not cli_flags.no_prompt:
|
||||
print("\nDo you want to reset the token? (y/n)")
|
||||
|
||||
@ -126,7 +126,6 @@ class Cleanup:
|
||||
return
|
||||
|
||||
author = ctx.author
|
||||
is_bot = self.bot.user.bot
|
||||
|
||||
if number > 100:
|
||||
cont = await self.check_100_plus(ctx, number)
|
||||
@ -154,10 +153,7 @@ class Cleanup:
|
||||
)
|
||||
log.info(reason)
|
||||
|
||||
if is_bot:
|
||||
await mass_purge(to_delete, channel)
|
||||
else:
|
||||
await slow_deletion(to_delete)
|
||||
await mass_purge(to_delete, channel)
|
||||
|
||||
@cleanup.command()
|
||||
@commands.guild_only()
|
||||
@ -186,7 +182,6 @@ class Cleanup:
|
||||
_id = member.id
|
||||
|
||||
author = ctx.author
|
||||
is_bot = self.bot.user.bot
|
||||
|
||||
if number > 100:
|
||||
cont = await self.check_100_plus(ctx, number)
|
||||
@ -215,11 +210,7 @@ class Cleanup:
|
||||
)
|
||||
log.info(reason)
|
||||
|
||||
if is_bot:
|
||||
# For whatever reason the purge endpoint requires manage_messages
|
||||
await mass_purge(to_delete, channel)
|
||||
else:
|
||||
await slow_deletion(to_delete)
|
||||
await mass_purge(to_delete, channel)
|
||||
|
||||
@cleanup.command()
|
||||
@commands.guild_only()
|
||||
@ -238,11 +229,6 @@ class Cleanup:
|
||||
await ctx.send("I need the Manage Messages permission to do this.")
|
||||
return
|
||||
author = ctx.author
|
||||
is_bot = self.bot.user.bot
|
||||
|
||||
if not is_bot:
|
||||
await ctx.send(_("This command can only be used on bots with bot accounts."))
|
||||
return
|
||||
|
||||
try:
|
||||
after = await channel.get_message(message_id)
|
||||
@ -274,8 +260,6 @@ class Cleanup:
|
||||
return
|
||||
author = ctx.author
|
||||
|
||||
is_bot = self.bot.user.bot
|
||||
|
||||
if number > 100:
|
||||
cont = await self.check_100_plus(ctx, number)
|
||||
if not cont:
|
||||
@ -291,10 +275,7 @@ class Cleanup:
|
||||
)
|
||||
log.info(reason)
|
||||
|
||||
if is_bot:
|
||||
await mass_purge(to_delete, channel)
|
||||
else:
|
||||
await slow_deletion(to_delete)
|
||||
await mass_purge(to_delete, channel)
|
||||
|
||||
@cleanup.command(name="bot")
|
||||
@commands.guild_only()
|
||||
@ -306,7 +287,6 @@ class Cleanup:
|
||||
await ctx.send("I need the Manage Messages permission to do this.")
|
||||
return
|
||||
author = ctx.message.author
|
||||
is_bot = self.bot.user.bot
|
||||
|
||||
if number > 100:
|
||||
cont = await self.check_100_plus(ctx, number)
|
||||
@ -348,10 +328,7 @@ class Cleanup:
|
||||
)
|
||||
log.info(reason)
|
||||
|
||||
if is_bot:
|
||||
await mass_purge(to_delete, channel)
|
||||
else:
|
||||
await slow_deletion(to_delete)
|
||||
await mass_purge(to_delete, channel)
|
||||
|
||||
@cleanup.command(name="self")
|
||||
async def cleanup_self(
|
||||
@ -373,7 +350,6 @@ class Cleanup:
|
||||
"""
|
||||
channel = ctx.channel
|
||||
author = ctx.message.author
|
||||
is_bot = self.bot.user.bot
|
||||
|
||||
if number > 100:
|
||||
cont = await self.check_100_plus(ctx, number)
|
||||
@ -420,10 +396,6 @@ class Cleanup:
|
||||
delete_pinned=delete_pinned,
|
||||
)
|
||||
|
||||
# Selfbot convenience, delete trigger message
|
||||
if author == self.bot.user:
|
||||
to_delete.append(ctx.message)
|
||||
|
||||
if ctx.guild:
|
||||
channel_name = "channel " + channel.name
|
||||
else:
|
||||
@ -436,7 +408,7 @@ class Cleanup:
|
||||
)
|
||||
log.info(reason)
|
||||
|
||||
if is_bot and can_mass_purge:
|
||||
if can_mass_purge:
|
||||
await mass_purge(to_delete, channel)
|
||||
else:
|
||||
await slow_deletion(to_delete)
|
||||
|
||||
@ -111,14 +111,6 @@ def parse_cli_flags(args):
|
||||
help="Force loading specified cogs from the installed packages. "
|
||||
"Can be used with the --no-cogs flag to load these cogs exclusively.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--self-bot", action="store_true", help="Specifies if Red should log in as selfbot"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--not-bot",
|
||||
action="store_true",
|
||||
help="Specifies if the token used belongs to a bot account.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--dry-run",
|
||||
action="store_true",
|
||||
|
||||
@ -235,10 +235,8 @@ class CoreLogic:
|
||||
str
|
||||
Invite URL.
|
||||
"""
|
||||
if self.bot.user.bot:
|
||||
app_info = await self.bot.application_info()
|
||||
return discord.utils.oauth_url(app_info.id)
|
||||
return "Not a bot account!"
|
||||
app_info = await self.bot.application_info()
|
||||
return discord.utils.oauth_url(app_info.id)
|
||||
|
||||
|
||||
@i18n.cog_i18n(_)
|
||||
@ -432,10 +430,7 @@ class Core(CoreLogic):
|
||||
@checks.is_owner()
|
||||
async def invite(self, ctx):
|
||||
"""Show's Red's invite url"""
|
||||
if self.bot.user.bot:
|
||||
await ctx.author.send(await self._invite_url())
|
||||
else:
|
||||
await ctx.send("I'm not a bot account. I have no invite URL.")
|
||||
await ctx.author.send(await self._invite_url())
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
|
||||
@ -94,10 +94,7 @@ def init_events(bot, cli_flags):
|
||||
data = await bot.application_info()
|
||||
invite_url = discord.utils.oauth_url(data.id)
|
||||
except:
|
||||
if bot.user.bot:
|
||||
invite_url = "Could not fetch invite url"
|
||||
else:
|
||||
invite_url = None
|
||||
invite_url = "Could not fetch invite url"
|
||||
|
||||
prefixes = cli_flags.prefix or (await bot.db.prefix())
|
||||
lang = await bot.db.locale()
|
||||
|
||||
@ -194,19 +194,6 @@ def cli_flag_getter():
|
||||
choice = user_choice()
|
||||
if choice == "y":
|
||||
flags.append("--no-cogs")
|
||||
print("Is this a selfbot? (y/n)")
|
||||
choice = user_choice()
|
||||
if choice == "y":
|
||||
print(
|
||||
"Please note that selfbots are not allowed by Discord. See"
|
||||
"https://support.discordapp.com/hc/en-us/articles/115002192352-Automated-user-accounts-self-bots-"
|
||||
"for more information."
|
||||
)
|
||||
flags.append("--self-bot")
|
||||
print("Does this token belong to a user account rather than a bot account? (y/n)")
|
||||
choice = user_choice()
|
||||
if choice == "y":
|
||||
flags.append("--not-bot")
|
||||
print("Do you want to do a dry run? (y/n)")
|
||||
choice = user_choice()
|
||||
if choice == "y":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user