From 4e6c824e60483a8ca9108d088d86e04a9809c25f Mon Sep 17 00:00:00 2001 From: insert Date: Thu, 26 Dec 2024 14:31:39 -0500 Subject: [PATCH] Update --- starboard.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/starboard.py b/starboard.py index 7cc7f19..f341e5f 100644 --- a/starboard.py +++ b/starboard.py @@ -22,7 +22,7 @@ class starboard(commands.Cog): print(payload.emoji.name, file=sys.stderr) chann = self.bot.get_channel(payload.channel_id) message = await chann.fetch_message(payload.message_id) - res = await.cur.execute(f"SELECT emoji, starchannel, minimumneeded, selfstar FROM starsettings WHERE serverid = {message.guild.id}") + res = await self.bot.cur.execute(f"SELECT emoji, starchannel, minimumneeded, selfstar FROM starsettings WHERE serverid = {message.guild.id}") try: emoji, starchannel, minimumneeded, selfstar = await res.fetchone() except TypeError: @@ -36,5 +36,27 @@ class starboard(commands.Cog): await message.forward(self.bot.get_channel(starchannel)) return + @nextcord.slash_command( + name="starboard", + description="For all your starring needs", + default_member_permissions=nextcord.Permissions(manage_messages=True), + ) + async def starboard(self, interaction: nextcord.Interaction): + return + + @starboard.subcommand( + name="create", + description="Create a starboard, escape the emoji", + force_global=True, + ) + async def createstarboard(self, interaction: nextcord.Interaction, reaction: str, channel: nextcord.channel, minimumneeded: int, selfstar: str = nextcord.SlashOption(choices=["Yes", "No"])): + selfstar = False + if selfstar == "Yes": + selfstar = True + await self.bot.cur.execute(f""" + INSERT INTO userinfo VALUES + ({reaction}, {channel.id}, '{minimumneeded}', '{selfstar}', {interaction.guild_id}) + """) + def setup(bot: commands.Bot): bot.add_cog(starboard(bot)) \ No newline at end of file