From 6ebfdef02572d86735f836dd90975d3966503569 Mon Sep 17 00:00:00 2001 From: Michael H Date: Fri, 24 Aug 2018 08:51:03 -0400 Subject: [PATCH] Remove self-bot support (#2008) --- redbot/__main__.py | 9 ++------ redbot/cogs/cleanup/cleanup.py | 38 +++++----------------------------- redbot/core/cli.py | 8 ------- redbot/core/core_commands.py | 11 +++------- redbot/core/events.py | 5 +---- redbot/launcher.py | 13 ------------ 6 files changed, 11 insertions(+), 73 deletions(-) diff --git a/redbot/__main__.py b/redbot/__main__.py index 3dc4014e4..14c40958a 100644 --- a/redbot/__main__.py +++ b/redbot/__main__.py @@ -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)") diff --git a/redbot/cogs/cleanup/cleanup.py b/redbot/cogs/cleanup/cleanup.py index ccfac2cce..935805856 100644 --- a/redbot/cogs/cleanup/cleanup.py +++ b/redbot/cogs/cleanup/cleanup.py @@ -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) diff --git a/redbot/core/cli.py b/redbot/core/cli.py index 6a79c9ba1..29ff80321 100644 --- a/redbot/core/cli.py +++ b/redbot/core/cli.py @@ -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", diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index fb36e36ae..c155f1caf 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -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() diff --git a/redbot/core/events.py b/redbot/core/events.py index 1c9b0aa7b..0c1b6c2e3 100644 --- a/redbot/core/events.py +++ b/redbot/core/events.py @@ -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() diff --git a/redbot/launcher.py b/redbot/launcher.py index d5dc32599..b706ad111 100644 --- a/redbot/launcher.py +++ b/redbot/launcher.py @@ -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":