From 0898aaf4de42e9e1bf97d263bf66f91ded99dcaf Mon Sep 17 00:00:00 2001 From: phixxy Date: Tue, 30 Jan 2024 03:17:13 -0800 Subject: [PATCH] changed personality to accept no args and display current personality --- extensions/chatgpt.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/extensions/chatgpt.py b/extensions/chatgpt.py index e4b4ce1..fc5a757 100644 --- a/extensions/chatgpt.py +++ b/extensions/chatgpt.py @@ -106,14 +106,19 @@ class ChatGPT(commands.Cog): @commands.command( - description="Personality", - help="Set the personality of the bot. Usage: !personality (personality)", + description="Personality", + help="Set the personality of the bot. Usage: !personality (personality)", brief="Set the personality" - ) - async def personality(self, ctx): - personality_type = ctx.message.content.split(" ", maxsplit=1)[1] - self.edit_channel_config(ctx.channel.id, "personality", personality_type) - await ctx.send("Personality changed to " + personality_type) + ) + async def personality(self, ctx, personality_type=None): + if personality_type: + self.edit_channel_config(ctx.channel.id, "personality", personality_type) + await ctx.send("Personality changed to " + personality_type) + else: + channel_config = await self.get_channel_config(ctx.channel.id) + current_personality = channel_config["personality"] + await ctx.send(f"Current personality is {current_personality}") + @commands.command( description="Topic",