From 6080ac538f99ccac9aa599e12e4b8d82d94dd1f6 Mon Sep 17 00:00:00 2001 From: Kaylee Date: Tue, 3 Jun 2025 16:48:57 -0400 Subject: [PATCH 1/2] initial commit for kaylee --- a.py | 0 .../cogs/onboarding/kaylee_onboarding_cog.py | 43 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 a.py create mode 100644 src/capy_app/frontend/cogs/onboarding/kaylee_onboarding_cog.py diff --git a/a.py b/a.py new file mode 100644 index 0000000..e69de29 diff --git a/src/capy_app/frontend/cogs/onboarding/kaylee_onboarding_cog.py b/src/capy_app/frontend/cogs/onboarding/kaylee_onboarding_cog.py new file mode 100644 index 0000000..e28b9d8 --- /dev/null +++ b/src/capy_app/frontend/cogs/onboarding/kaylee_onboarding_cog.py @@ -0,0 +1,43 @@ +import discord +import logging +from discord.ext import commands +from discord import app_commands + +from frontend import config_colors as colors +from config import settings + +#change everything with "Ping" +class KayleeCog(commands.Cog): + def __init__(self, bot: commands.Bot): + self.bot = bot + self.logger = logging.getLogger( + f"discord.cog.{self.__class__.__name__.lower()}" + ) + + @app_commands.guilds(discord.Object(id=settings.DEBUG_GUILD_ID)) + @app_commands.command(name="poll", description="Shows the bot's latency") + async def poll(self, interaction: discord.Interaction, question: str, choice1: str, choice2: str, choice3: str = None): + choices = [choice1, choice2] + if choice3: + choices.append(choice3) + emojis = ["1️⃣", "2️⃣", "3️⃣"] + + + descriptions = [] #to describe each choice + for i, choice in enumerate(choices): #enumerate gives index & choice text while looping through choices + descrip = f"{emojis[i]} {choice}" #combine emoji (number) + choice + descriptions.append(descrip) #add line to descriptions + + + message = f"⏱ {round(self.bot.latency * 1000)} ms Latency!" + embed = discord.Embed( + title="Poll", + description=message, + color=colors.POLL, #renamed PING to POLL ... idk if i was supposed to do this + ) + self.logger.info(message) + await interaction.response.send_message(embed=embed) + + +async def setup(bot: commands.Bot): + await bot.add_cog(KayleeCog(bot)) From 3c92969c410f43fbeb3a415cf564d453d71b8b80 Mon Sep 17 00:00:00 2001 From: Kaylee Date: Fri, 6 Jun 2025 13:43:14 -0400 Subject: [PATCH 2/2] update cog --- .../cogs/onboarding/kaylee_onboarding_cog.py | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/capy_app/frontend/cogs/onboarding/kaylee_onboarding_cog.py b/src/capy_app/frontend/cogs/onboarding/kaylee_onboarding_cog.py index e28b9d8..44ec50d 100644 --- a/src/capy_app/frontend/cogs/onboarding/kaylee_onboarding_cog.py +++ b/src/capy_app/frontend/cogs/onboarding/kaylee_onboarding_cog.py @@ -15,28 +15,32 @@ def __init__(self, bot: commands.Bot): ) @app_commands.guilds(discord.Object(id=settings.DEBUG_GUILD_ID)) - @app_commands.command(name="poll", description="Shows the bot's latency") - async def poll(self, interaction: discord.Interaction, question: str, choice1: str, choice2: str, choice3: str = None): - choices = [choice1, choice2] - if choice3: - choices.append(choice3) + @app_commands.command(name="poll", description="Custom poll with 3 choices") + async def poll(self, interaction: discord.Interaction, question: str, choice_1: str, choice_2: str, choice_3: str): + choices = [choice_1, choice_2, choice_3] emojis = ["1️⃣", "2️⃣", "3️⃣"] + #description string creation + descriptions = [] + for i in range(3): + descrip = emojis[i] + " " + choices[i] + descriptions.append(descrip) + message = "\n".join(descriptions) #combine all into one string + - descriptions = [] #to describe each choice - for i, choice in enumerate(choices): #enumerate gives index & choice text while looping through choices - descrip = f"{emojis[i]} {choice}" #combine emoji (number) + choice - descriptions.append(descrip) #add line to descriptions - - - message = f"⏱ {round(self.bot.latency * 1000)} ms Latency!" + #description embed embed = discord.Embed( - title="Poll", - description=message, - color=colors.POLL, #renamed PING to POLL ... idk if i was supposed to do this + title = "Poll: " + question, + description = message, + #color = colors.POLL, #couldn't get it to work :( gave me errors ) - self.logger.info(message) - await interaction.response.send_message(embed=embed) + self.logger.info(message) #logs message + await interaction.response.send_message(embed=embed) #replies to command with the embed + + #adding emoji reactions for voting + msg = await interaction.original_response() #get the reply message + for i in range(3): + await msg.add_reaction(emojis[i]) #reacts to that msg with each emoji async def setup(bot: commands.Bot):