From d64da1aa9afef755fa2f03dd037f5fd8284092d3 Mon Sep 17 00:00:00 2001 From: Slipstreamm Date: Sat, 14 Jun 2025 12:37:55 -0600 Subject: [PATCH] refactor(oauth): Refine authentication success messages Update various success messages and help text related to OAuth. Instead of broadly stating the bot gains general API access, the language now specifies that it gains access to "scopes" or "additional OAuth scopes" as allowed during the authentication flow, providing a more precise understanding of the permissions granted. --- api_service/api_server.py | 1 - cogs/oauth_cog.py | 15 +++++++-------- oauth_server.py | 1 - 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/api_service/api_server.py b/api_service/api_server.py index f48c033..978c16e 100644 --- a/api_service/api_server.py +++ b/api_service/api_server.py @@ -1183,7 +1183,6 @@ async def auth(

You have successfully authenticated with Discord.

You can now close this window and return to Discord.

-

Your Discord bot is now authorized to access the API on your behalf.

diff --git a/cogs/oauth_cog.py b/cogs/oauth_cog.py index 3e4148e..3983035 100644 --- a/cogs/oauth_cog.py +++ b/cogs/oauth_cog.py @@ -82,7 +82,7 @@ class OAuthCog(commands.Cog): if token: # Token is available locally, send a success message await channel.send( - f"<@{user_id}> ✅ Authentication successful! You can now use the API." + f"<@{user_id}> ✅ Authentication successful!" ) return @@ -116,7 +116,7 @@ class OAuthCog(commands.Cog): user_id, token_data ) await channel.send( - f"<@{user_id}> ✅ Authentication successful! You can now use the API." + f"<@{user_id}> ✅ Authentication successful!" ) return except Exception as e: @@ -140,8 +140,7 @@ class OAuthCog(commands.Cog): # Send a DM to the user try: await discord_user.send( - f"✅ Authentication successful! You are now logged in as {user_info.get('username')}#{user_info.get('discriminator')}.\n" - f"Your Discord bot is now authorized to access the API on your behalf." + f"✅ Authentication successful! You are now logged in as {user_info.get('username')}#{user_info.get('discriminator')}." ) except discord.errors.Forbidden: # If we can't send a DM, try to find the channel where the auth command was used @@ -296,7 +295,7 @@ class OAuthCog(commands.Cog): await ctx.send( f"✅ You are authenticated as {username}#{discriminator}.\n" - f"The bot can access the API on your behalf." + f"The bot can access any scopes granted by this token." ) return except discord_oauth.OAuthError: @@ -350,7 +349,7 @@ class OAuthCog(commands.Cog): await ctx.send( f"✅ You are authenticated as {username}#{discriminator}.\n" - f"The bot can access the API on your behalf.\n" + f"The bot can access any scopes you allowed when authenticating.\n" f"(Token retrieved from API service)" ) return @@ -382,7 +381,7 @@ class OAuthCog(commands.Cog): embed.add_field( name="!auth", - value="Authenticate with Discord to allow the bot to access the API on your behalf", + value="Authenticate with Discord to allow the bot to access additional OAuth scopes", inline=False, ) @@ -401,5 +400,5 @@ class OAuthCog(commands.Cog): await ctx.send(embed=embed) -async def setup(bot): +async def setup(bot: commands.Bot): await bot.add_cog(OAuthCog(bot)) diff --git a/oauth_server.py b/oauth_server.py index 3b49d19..6773306 100644 --- a/oauth_server.py +++ b/oauth_server.py @@ -76,7 +76,6 @@ async def handle_oauth_callback(request: web.Request) -> web.Response:

You have successfully authenticated with Discord.

You can now close this window and return to Discord.

-

Your Discord bot is now authorized to access the API on your behalf.