From 4bdd2a72032653eb47718e2fe4afb2c8f09c561d Mon Sep 17 00:00:00 2001 From: phixxy Date: Tue, 30 Jan 2024 03:23:10 -0800 Subject: [PATCH] changed topic command to output topic if not given arg --- extensions/chatgpt.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/extensions/chatgpt.py b/extensions/chatgpt.py index fc5a757..825f861 100644 --- a/extensions/chatgpt.py +++ b/extensions/chatgpt.py @@ -113,7 +113,7 @@ class ChatGPT(commands.Cog): 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) + await ctx.send(f"Personality changed to {personality_type}") else: channel_config = await self.get_channel_config(ctx.channel.id) current_personality = channel_config["personality"] @@ -121,13 +121,19 @@ class ChatGPT(commands.Cog): @commands.command( - description="Topic", - help="Set the channel topic for the bot. Usage: !topic (topic)", + description="Topic", + help="Set the channel topic for the bot. Usage: !topic (topic)", brief="Set channel topic" - ) - async def topic(self, ctx, channel_topic): - self.edit_channel_config(ctx.channel.id, "channel_topic", channel_topic) - await ctx.send("Topic changed to " + channel_topic) + ) + async def topic(self, ctx, channel_topic=None): + if channel_topic: + self.edit_channel_config(ctx.channel.id, "channel_topic", channel_topic) + await ctx.send(f"Topic changed to {channel_topic}") + else: + channel_config = await self.get_channel_config(ctx.channel.id) + current_topic = channel_config["channel_topic"] + await ctx.send(f"Current topic is {current_topic}") + @commands.command( description="Chat",