diff --git a/cogs/draw_image_generation.py b/cogs/draw_image_generation.py index 874c4e6..fd22174 100644 --- a/cogs/draw_image_generation.py +++ b/cogs/draw_image_generation.py @@ -208,7 +208,9 @@ class DrawDallEService(commands.Cog, name="DrawDallEService"): class SaveView(discord.ui.View): def __init__(self, image_urls, cog, converser_cog, no_retry=False, only_save=None): - super().__init__(timeout=600 if not only_save else None) # 10 minute timeout for Retry, Save + super().__init__( + timeout=600 if not only_save else None + ) # 10 minute timeout for Retry, Save self.image_urls = image_urls self.cog = cog self.no_retry = no_retry @@ -232,7 +234,9 @@ class SaveView(discord.ui.View): self.clear_items() # Create a new view with the same params as this one, but pass only_save=True - new_view = SaveView(self.image_urls, self.cog, self.converser_cog, self.no_retry, only_save=True) + new_view = SaveView( + self.image_urls, self.cog, self.converser_cog, self.no_retry, only_save=True + ) # Set the view of the message to the new view await self.message.edit(view=new_view) diff --git a/cogs/gpt_3_commands_and_converser.py b/cogs/gpt_3_commands_and_converser.py index cb9fe49..2ba5614 100644 --- a/cogs/gpt_3_commands_and_converser.py +++ b/cogs/gpt_3_commands_and_converser.py @@ -379,7 +379,9 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"): if len(response_text) > self.TEXT_CUTOFF: await self.paginate_and_send(response_text, message) else: - response_message = await message.reply(response_text, view=RedoView(self)) + response_message = await message.reply( + response_text, view=RedoView(self) + ) redo_users[message.author.id] = RedoUser( prompt, message, response_message ) @@ -544,9 +546,10 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"): # Send the request to the model await self.encapsulated_send(message, prompt) + class RedoView(discord.ui.View): def __init__(self, converser_cog): - super().__init__(timeout=3600) # 1 hour interval to redo. + super().__init__(timeout=3600) # 1 hour interval to redo. self.converser_cog = converser_cog self.add_item(RedoButton(self.converser_cog)) @@ -558,6 +561,7 @@ class RedoView(discord.ui.View): view=None, ) + class RedoButton(discord.ui.Button["RedoView"]): def __init__(self, converser_cog): super().__init__(style=discord.ButtonStyle.danger, label="Retry") @@ -581,4 +585,6 @@ class RedoButton(discord.ui.Button["RedoView"]): message = redo_users[user_id].message prompt = redo_users[user_id].prompt response_message = redo_users[user_id].response - await self.converser_cog.encapsulated_send(message, prompt, response_message) + await self.converser_cog.encapsulated_send( + message, prompt, response_message + )