From c9a8dd85437891e2e9e47359baf528b1902ec12b Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:34:11 +0000 Subject: [PATCH 01/10] Remove trailing whitespaces --- cogs/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cogs/utils.py b/cogs/utils.py index 343de5e1..12fb05d9 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -29,7 +29,7 @@ def __init__(self, bot): description='Sends a bot message in the channel' ) @option(name="text", description="What do you want to send?", type=str) - async def echo(self, ctx: ApplicationContext, text:str): + async def echo(self, ctx: ApplicationContext, text: str): await ctx.respond("Echoed!", ephemeral=True) await ctx.channel.send(text) @@ -121,7 +121,7 @@ async def status(self, ctx: ApplicationContext): localembed.add_field(name="Release Notes", value="[latest](https://github.com/PyBotDevs/isobot/releases/latest)") localembed.set_footer(text=f"Requested by {ctx.author.name}", icon_url=ctx.author.avatar_url) await ctx.respond(embed=localembed) - + @commands.slash_command( name="chatgpt", description="Talk to ChatGPT and get a response back." @@ -144,7 +144,7 @@ async def chatgpt(self, ctx: ApplicationContext, message: str): localembed.set_author(name="ChatGPT", icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/ChatGPT_logo.svg/1200px-ChatGPT_logo.svg.png") localembed.set_footer(text="Powered by OpenAI") await ctx.respond(embed=localembed) - + @commands.slash_command( name="generate_image", description="Generate an image of your choice using the DALL-E modal." From 6ffe5ddb0f9bab6b42f9849e31c0bc3549f405da Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:37:48 +0000 Subject: [PATCH 02/10] Add missing command docstrings --- cogs/utils.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cogs/utils.py b/cogs/utils.py index 12fb05d9..dd5d77d3 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -21,15 +21,18 @@ # Commands class Utils(commands.Cog): + """The utils cog class.""" + def __init__(self, bot): self.bot = bot @commands.slash_command( name='echo', - description='Sends a bot message in the channel' + description='Sends a bot message in the channel.' ) @option(name="text", description="What do you want to send?", type=str) async def echo(self, ctx: ApplicationContext, text: str): + """Sends a bot message in the channel.""" await ctx.respond("Echoed!", ephemeral=True) await ctx.channel.send(text) @@ -38,12 +41,13 @@ async def echo(self, ctx: ApplicationContext, text: str): description="Shows the open-source code links for isobot." ) async def repo(self, ctx: ApplicationContext): + """Shows the open-source code links for isobot.""" localembed = discord.Embed(title="Source-code Repositories", description="See and contribute to **isobot's [GitHub repository](https://github.com/PyBotDevs/isobot)**\nSee our **[GitHub organization](https://github.com/PyBotDevs)**", color=color) await ctx.respond(embed=localembed) @commands.slash_command( name="embedbuilder", - description="Builds a custom embed however you want" + description="Builds a custom embed however you want." ) @option(name="title", description="The title of the embed", type=str) @option(name="description", description="The body of the embed", type=str) @@ -53,15 +57,17 @@ async def repo(self, ctx: ApplicationContext): @option(name="footer_text", description="The text at the footer of the embed", type=str, default=None) @option(name="footer_icon_url", description="The icon you want to show in the embed's footer (URL ONLY)", type=str, default=None) async def embedbuilder(self, ctx: ApplicationContext, title: str, description: str, image_url: str = None, thumbnail_url: str = None, color: int = None, footer_text: str = None, footer_icon_url: str = None): + """Builds a custom embed however you want.""" await ctx.respond("Embed Built!", ephemeral=True) await ctx.channel.send(embed=embedengine.embed(title, description, image=image_url, thumbnail=thumbnail_url, color=color, footer_text=footer_text, footer_img=footer_icon_url)) @commands.slash_command( name='whoami', - description='Shows information on a user' + description='Shows information on a user.' ) @option(name="user", description="Who do you want to know about?", type=discord.User, default=None) async def whoami(self, ctx: ApplicationContext, user: discord.User=None): + """Shows information on a user.""" if user is None: user = ctx.author username = user displayname = user.display_name @@ -88,10 +94,11 @@ async def whoami(self, ctx: ApplicationContext, user: discord.User=None): @commands.slash_command( name="profile", - description="Shows basic stats about your isobot profile, or someone else's profile stats" + description="Shows basic stats about your isobot profile, or someone else's profile stats." ) @option(name="user", description="Whose isobot profile do you want to view?", type=discord.User, default=None) async def profile(self, ctx: ApplicationContext, user: discord.User = None): + """Shows basic stats about your isobot profile, or someone else's profile stats.""" if user is None: user = ctx.author localembed = discord.Embed(title=f"{user.display_name}'s isobot stats", color=color) localembed.set_thumbnail(url=user.avatar) @@ -105,9 +112,10 @@ async def profile(self, ctx: ApplicationContext, user: discord.User = None): @commands.slash_command( name="status", - description="Shows the current client info" + description="Shows the current client info." ) async def status(self, ctx: ApplicationContext): + """Shows the current client info.""" os_name = os.name sys_ram = str(f"{psutil.virtual_memory()[2]}GiB") sys_cpu = str(f"{psutil.cpu_percent(1)}%") @@ -129,6 +137,7 @@ async def status(self, ctx: ApplicationContext): @option(name="message", description="What do you want to send to ChatGPT?", type=str) @commands.cooldown(1, 1, commands.BucketType.user) async def chatgpt(self, ctx: ApplicationContext, message: str): + """Talk to ChatGPT and get a response back.""" if str(ctx.author.id) not in chatgpt_conversation: chatgpt_conversation[str(ctx.author.id)] = [{"role": "system", "content": "You are a intelligent assistant."}] await ctx.defer() try: @@ -153,6 +162,7 @@ async def chatgpt(self, ctx: ApplicationContext, message: str): @option(name="resolution", description="Set a custom resolution for your generated image", type=str, default="512x512", choices=["256x256", "512x512", "1024x1024"]) @commands.cooldown(1, 10, commands.BucketType.user) async def generate_image(self, ctx: ApplicationContext, prompt: str, resolution: str = "512x512"): + """Generate an image of your choice using the DALL-E modal.""" parsed_resolution: list = resolution.split("x") max_index: int = 0 for index in parsed_resolution: max_index += 1 From af0a95654eb6053a712ddf53fde354a53659484d Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:39:53 +0000 Subject: [PATCH 03/10] Add a missing docstring --- cogs/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cogs/utils.py b/cogs/utils.py index dd5d77d3..fd3fb3ee 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -190,4 +190,6 @@ async def generate_image(self, ctx: ApplicationContext, prompt: str, resolution: await ctx.respond(embed=localembed) # Cog Initialization -def setup(bot): bot.add_cog(Utils(bot)) +def setup(bot): + """Initializes the cog.""" + bot.add_cog(Utils(bot)) From 68d2e7f52852882e5e56b6470daff8667456fc01 Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:48:54 +0000 Subject: [PATCH 04/10] Multi-line some longer lines --- cogs/utils.py | 58 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/cogs/utils.py b/cogs/utils.py index fd3fb3ee..ccb79250 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -42,7 +42,11 @@ async def echo(self, ctx: ApplicationContext, text: str): ) async def repo(self, ctx: ApplicationContext): """Shows the open-source code links for isobot.""" - localembed = discord.Embed(title="Source-code Repositories", description="See and contribute to **isobot's [GitHub repository](https://github.com/PyBotDevs/isobot)**\nSee our **[GitHub organization](https://github.com/PyBotDevs)**", color=color) + localembed = discord.Embed( + title="Source-code Repositories", + description="See and contribute to **isobot's [GitHub repository](https://github.com/PyBotDevs/isobot)**\nSee our **[GitHub organization](https://github.com/PyBotDevs)**", + color=color + ) await ctx.respond(embed=localembed) @commands.slash_command( @@ -59,7 +63,17 @@ async def repo(self, ctx: ApplicationContext): async def embedbuilder(self, ctx: ApplicationContext, title: str, description: str, image_url: str = None, thumbnail_url: str = None, color: int = None, footer_text: str = None, footer_icon_url: str = None): """Builds a custom embed however you want.""" await ctx.respond("Embed Built!", ephemeral=True) - await ctx.channel.send(embed=embedengine.embed(title, description, image=image_url, thumbnail=thumbnail_url, color=color, footer_text=footer_text, footer_img=footer_icon_url)) + await ctx.channel.send( + embed=embedengine.embed( + title, + description, + image=image_url, + thumbnail=thumbnail_url, + color=color, + footer_text=footer_text, + footer_img=footer_icon_url + ) + ) @commands.slash_command( name='whoami', @@ -75,7 +89,8 @@ async def whoami(self, ctx: ApplicationContext, user: discord.User=None): pfp = user.avatar localembed_desc = f"`AKA` {displayname}" presence = get_presence(ctx.author.id, ctx.guild.id) - if presence is not False: localembed_desc += f"\n`🌙 AFK` {presence['response']} - " + if presence is not False: + localembed_desc += f"\n`🌙 AFK` {presence['response']} - " localembed = discord.Embed( title=f'User Info on {username}', description=localembed_desc @@ -102,10 +117,26 @@ async def profile(self, ctx: ApplicationContext, user: discord.User = None): if user is None: user = ctx.author localembed = discord.Embed(title=f"{user.display_name}'s isobot stats", color=color) localembed.set_thumbnail(url=user.avatar) - localembed.add_field(name="Level", value=f"Level {levelling.get_level(user.id)} ({levelling.get_xp(user.id)} XP)", inline=False) - localembed.add_field(name="Balance in Wallet", value=f"{currency.get_wallet(user.id)} coins", inline=True) - localembed.add_field(name="Balance in Bank Account", value=f"{currency.get_bank(user.id)} coins", inline=True) - localembed.add_field(name="Net-Worth", value=f"{currency.get_user_networth(user.id)} coins", inline=True) + localembed.add_field( + name="Level", + value=f"Level {levelling.get_level(user.id)} ({levelling.get_xp(user.id)} XP)", + inline=False + ) + localembed.add_field( + name="Balance in Wallet", + value=f"{currency.get_wallet(user.id)} coins", + inline=True + ) + localembed.add_field( + name="Balance in Bank Account", + value=f"{currency.get_bank(user.id)} coins", + inline=True + ) + localembed.add_field( + name="Net-Worth", + value=f"{currency.get_user_networth(user.id)} coins", + inline=True + ) # More stats will be added later # Maybe I should make a userdat system for collecting statistical data to process and display here, coming in a future update. await ctx.respond(embed=localembed) @@ -138,11 +169,20 @@ async def status(self, ctx: ApplicationContext): @commands.cooldown(1, 1, commands.BucketType.user) async def chatgpt(self, ctx: ApplicationContext, message: str): """Talk to ChatGPT and get a response back.""" - if str(ctx.author.id) not in chatgpt_conversation: chatgpt_conversation[str(ctx.author.id)] = [{"role": "system", "content": "You are a intelligent assistant."}] + if str(ctx.author.id) not in chatgpt_conversation: + chatgpt_conversation[str(ctx.author.id)] = [ + { + "role": "system", + "content": "You are a intelligent assistant." + } + ] await ctx.defer() try: chatgpt_conversation[str(ctx.author.id)].append({"role": "user", "content": message}) - _chat = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=chatgpt_conversation[str(ctx.author.id)]) + _chat = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=chatgpt_conversation[str(ctx.author.id)] + ) _reply = _chat.choices[0].message.content chatgpt_conversation[str(ctx.author.id)].append({"role": "assistant", "content": _reply}) except openai.error.RateLimitError: return await ctx.respond("The OpenAI API is currently being rate-limited. Try again after some time.", ephemeral=True) From 88a9cf0cdf841038fd3c288930a8d81dd4a2bf03 Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:50:12 +0000 Subject: [PATCH 05/10] Improve grammar --- cogs/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/utils.py b/cogs/utils.py index ccb79250..cc35527d 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -210,7 +210,7 @@ async def generate_image(self, ctx: ApplicationContext, prompt: str, resolution: res_width = int(parsed_resolution[0]) res_height = int(parsed_resolution[1]) if res_width < 256 or res_height < 256: return await ctx.respond("Your custom resolution needs to be at least 256p or higher.", ephermeral=True) - if res_width > 1024 or res_height > 1024: return await ctx.respond("Your image output resolution cannot be higher than 1024p.", ephemeral=True) + if res_width > 1024 or res_height > 1024: return await ctx.respond("Your image output resolution cannot exceed 1024p.", ephemeral=True) await ctx.defer() try: response = openai.Image.create( From 6c10b5f418f36b6991b0abb4ffbcfb07f0625228 Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:54:05 +0000 Subject: [PATCH 06/10] Remove trailing whitespace --- cogs/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/utils.py b/cogs/utils.py index cc35527d..39d31f9f 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -89,7 +89,7 @@ async def whoami(self, ctx: ApplicationContext, user: discord.User=None): pfp = user.avatar localembed_desc = f"`AKA` {displayname}" presence = get_presence(ctx.author.id, ctx.guild.id) - if presence is not False: + if presence is not False: localembed_desc += f"\n`🌙 AFK` {presence['response']} - " localembed = discord.Embed( title=f'User Info on {username}', From 2e446661c77a84dc8dbb9cf91ab60798bdd9c9bd Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:54:21 +0000 Subject: [PATCH 07/10] Rearrange imports --- cogs/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/utils.py b/cogs/utils.py index 39d31f9f..f2e4bc51 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -1,11 +1,11 @@ """The isobot cog file for utility commands.""" # Imports -import discord import os import psutil import math import openai +import discord from framework.isobot import currency, embedengine from framework.isobot.db import levelling from discord import option, ApplicationContext From 2c3ba483ae3cc6a7bdda9988e74afeb0a71ab2d3 Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:56:32 +0000 Subject: [PATCH 08/10] Rearrange imports (again) --- cogs/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/utils.py b/cogs/utils.py index f2e4bc51..dc75dba5 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -2,8 +2,8 @@ # Imports import os -import psutil import math +import psutil import openai import discord from framework.isobot import currency, embedengine From b301c86d72607886bae040586831096e9e0cb0af Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 05:06:31 +0000 Subject: [PATCH 09/10] Fix all instances of multiple statements on one line --- cogs/utils.py | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/cogs/utils.py b/cogs/utils.py index dc75dba5..88bd0fe6 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -82,7 +82,8 @@ async def embedbuilder(self, ctx: ApplicationContext, title: str, description: s @option(name="user", description="Who do you want to know about?", type=discord.User, default=None) async def whoami(self, ctx: ApplicationContext, user: discord.User=None): """Shows information on a user.""" - if user is None: user = ctx.author + if user is None: + user = ctx.author username = user displayname = user.display_name registered = user.joined_at.strftime("%b %d, %Y, %T") @@ -101,8 +102,9 @@ async def whoami(self, ctx: ApplicationContext, user: discord.User=None): localembed.add_field(name='Joined Discord on', value=registered, inline=False) localembed.add_field(name='Avatar URL', value=f"[here!]({pfp})", inline=True) role_render = "" - for p in user.roles: - if p != user.roles[0]: role_render += f"<@&{p.id}> " + for role in user.roles: + if role != user.roles[0]: + role_render += f"<@&{role.id}> " localembed.add_field(name='Roles', value=role_render, inline=False) localembed.add_field(name="Net worth", value=f"{currency.get_user_networth(user.id)} coins", inline=False) await ctx.respond(embed=localembed) @@ -114,7 +116,8 @@ async def whoami(self, ctx: ApplicationContext, user: discord.User=None): @option(name="user", description="Whose isobot profile do you want to view?", type=discord.User, default=None) async def profile(self, ctx: ApplicationContext, user: discord.User = None): """Shows basic stats about your isobot profile, or someone else's profile stats.""" - if user is None: user = ctx.author + if user is None: + user = ctx.author localembed = discord.Embed(title=f"{user.display_name}'s isobot stats", color=color) localembed.set_thumbnail(url=user.avatar) localembed.add_field( @@ -169,7 +172,7 @@ async def status(self, ctx: ApplicationContext): @commands.cooldown(1, 1, commands.BucketType.user) async def chatgpt(self, ctx: ApplicationContext, message: str): """Talk to ChatGPT and get a response back.""" - if str(ctx.author.id) not in chatgpt_conversation: + if str(ctx.author.id) not in chatgpt_conversation: chatgpt_conversation[str(ctx.author.id)] = [ { "role": "system", @@ -185,10 +188,14 @@ async def chatgpt(self, ctx: ApplicationContext, message: str): ) _reply = _chat.choices[0].message.content chatgpt_conversation[str(ctx.author.id)].append({"role": "assistant", "content": _reply}) - except openai.error.RateLimitError: return await ctx.respond("The OpenAI API is currently being rate-limited. Try again after some time.", ephemeral=True) - except openai.error.ServiceUnavailableError: return await ctx.respond("The ChatGPT service is currently unavailable.\nTry again after some time, or check it's status at https://status.openai.com", ephemeral=True) - except openai.error.APIError: return await ctx.respond("ChatGPT encountered an internal error. Please try again.", ephemeral=True) - except openai.error.Timeout: return await ctx.respond("Your request timed out. Please try again, or wait for a while.", ephemeral=True) + except openai.error.RateLimitError: + return await ctx.respond("The OpenAI API is currently being rate-limited. Try again after some time.", ephemeral=True) + except openai.error.ServiceUnavailableError: + return await ctx.respond("The ChatGPT service is currently unavailable.\nTry again after some time, or check it's status at https://status.openai.com", ephemeral=True) + except openai.error.APIError: + return await ctx.respond("ChatGPT encountered an internal error. Please try again.", ephemeral=True) + except openai.error.Timeout: + return await ctx.respond("Your request timed out. Please try again, or wait for a while.", ephemeral=True) localembed = discord.Embed(description=f"{_reply}", color=discord.Color.random()) localembed.set_author(name="ChatGPT", icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/ChatGPT_logo.svg/1200px-ChatGPT_logo.svg.png") localembed.set_footer(text="Powered by OpenAI") @@ -205,12 +212,16 @@ async def generate_image(self, ctx: ApplicationContext, prompt: str, resolution: """Generate an image of your choice using the DALL-E modal.""" parsed_resolution: list = resolution.split("x") max_index: int = 0 - for index in parsed_resolution: max_index += 1 - if max_index < 2 or max_index > 2: return await ctx.respond("Your resolution format is malformed. Please check it and try again.", ephemeral=True) + for index in parsed_resolution: + max_index += 1 + if max_index < 2 or max_index > 2: + return await ctx.respond("Your resolution format is malformed. Please check it and try again.", ephemeral=True) res_width = int(parsed_resolution[0]) res_height = int(parsed_resolution[1]) - if res_width < 256 or res_height < 256: return await ctx.respond("Your custom resolution needs to be at least 256p or higher.", ephermeral=True) - if res_width > 1024 or res_height > 1024: return await ctx.respond("Your image output resolution cannot exceed 1024p.", ephemeral=True) + if res_width < 256 or res_height < 256: + return await ctx.respond("Your custom resolution needs to be at least 256p or higher.", ephermeral=True) + if res_width > 1024 or res_height > 1024: + return await ctx.respond("Your image output resolution cannot exceed 1024p.", ephemeral=True) await ctx.defer() try: response = openai.Image.create( @@ -219,10 +230,14 @@ async def generate_image(self, ctx: ApplicationContext, prompt: str, resolution: size=resolution ) generated_image_url = response['data'][0]['url'] - except openai.error.RateLimitError: return await ctx.respond("The OpenAI API is currently being rate-limited. Try again after some time.", ephemeral=True) - except openai.error.ServiceUnavailableError: return await ctx.respond("The OpenAI service is currently unavailable.\nTry again after some time, or check it's status at https://status.openai.com", ephemeral=True) - except openai.error.APIError: return await ctx.respond("DALL-E encountered an internal error. Please try again.", ephemeral=True) - except openai.error.Timeout: return await ctx.respond("Your request timed out. Please try again, or wait for a while.", ephemeral=True) + except openai.error.RateLimitError: + return await ctx.respond("The OpenAI API is currently being rate-limited. Try again after some time.", ephemeral=True) + except openai.error.ServiceUnavailableError: + return await ctx.respond("The OpenAI service is currently unavailable.\nTry again after some time, or check it's status at https://status.openai.com", ephemeral=True) + except openai.error.APIError: + return await ctx.respond("DALL-E encountered an internal error. Please try again.", ephemeral=True) + except openai.error.Timeout: + return await ctx.respond("Your request timed out. Please try again, or wait for a while.", ephemeral=True) localembed = discord.Embed(title="Here's an image generated using your prompt.", color=discord.Color.random()) localembed.set_image(url=generated_image_url) localembed.set_author(name="DALL-E", icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/ChatGPT_logo.svg/1200px-ChatGPT_logo.svg.png") From 5f0a8bde27d282438ad035a1c3d8f4946eb0c0b7 Mon Sep 17 00:00:00 2001 From: Sabi <120003982+cyanogus@users.noreply.github.com> Date: Wed, 12 Jul 2023 05:07:40 +0000 Subject: [PATCH 10/10] Remove trailing whitespaces --- cogs/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cogs/utils.py b/cogs/utils.py index 88bd0fe6..56644982 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -82,7 +82,7 @@ async def embedbuilder(self, ctx: ApplicationContext, title: str, description: s @option(name="user", description="Who do you want to know about?", type=discord.User, default=None) async def whoami(self, ctx: ApplicationContext, user: discord.User=None): """Shows information on a user.""" - if user is None: + if user is None: user = ctx.author username = user displayname = user.display_name @@ -103,7 +103,7 @@ async def whoami(self, ctx: ApplicationContext, user: discord.User=None): localembed.add_field(name='Avatar URL', value=f"[here!]({pfp})", inline=True) role_render = "" for role in user.roles: - if role != user.roles[0]: + if role != user.roles[0]: role_render += f"<@&{role.id}> " localembed.add_field(name='Roles', value=role_render, inline=False) localembed.add_field(name="Net worth", value=f"{currency.get_user_networth(user.id)} coins", inline=False) @@ -116,7 +116,7 @@ async def whoami(self, ctx: ApplicationContext, user: discord.User=None): @option(name="user", description="Whose isobot profile do you want to view?", type=discord.User, default=None) async def profile(self, ctx: ApplicationContext, user: discord.User = None): """Shows basic stats about your isobot profile, or someone else's profile stats.""" - if user is None: + if user is None: user = ctx.author localembed = discord.Embed(title=f"{user.display_name}'s isobot stats", color=color) localembed.set_thumbnail(url=user.avatar)