From 1778fdcacc59da7a981497dfef59f2d281a72c9f Mon Sep 17 00:00:00 2001 From: insert Date: Fri, 9 Aug 2024 17:54:24 -0400 Subject: [PATCH] Update --- rolebuttons.py | 20 +++++++++++++++++--- speechbubble.py | 7 ------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/rolebuttons.py b/rolebuttons.py index b7e8b60..3569d88 100644 --- a/rolebuttons.py +++ b/rolebuttons.py @@ -39,12 +39,26 @@ class rolebutton(commands.Cog): bot.add_view(RoleView(bot)) @nextcord.slash_command( - name="roletest", - description="check if the buttons work", + name="rolebuttons", + description="modify role buttons", ) - async def roletest(self, interaction: nextcord.Interaction): + async def rolebuttons(self, interaction: nextcord.Interaction): + return self.bot.roleguild = interaction.guild await interaction.response.send_message(view=RoleView(self.bot)) + + @rolebuttons.subcommand( + name="refresh", + description="refresh a role selection message", + ) + async def rolerefresh(self, interaction: nextcord.Interaction, msgid: int): + msg = await nextcord.abc.Messageable.fetch_message(msgid) + if msg.author.id != self.bot.application_id: + await interaction.response.send_message("I can't edit that message", ephemeral=True) + return + await msg.edit(view=RoleView(self.bot)) + await interaction.response.send_message("Edited!", ephemeral=True) + def setup(bot: commands.Bot): bot.add_cog(rolebutton(bot)) \ No newline at end of file diff --git a/speechbubble.py b/speechbubble.py index 68117de..a33c095 100644 --- a/speechbubble.py +++ b/speechbubble.py @@ -111,16 +111,9 @@ class ApplicationModal(nextcord.ui.Modal): await interaction.send(f"<@{self.victim.id}> {interaction.user.name} proposes the following speech bubble for you:", embed=embed, view=ApplicationView(self.bot)) -async def dbcheck(db,cur): - res = await bot.cur.execute("SELECT name FROM sqlite_master WHERE name='userinfo'") - if await res.fetchone() is None: - await cur.execute("CREATE TABLE userinfo(serverid INTEGER, userid INTEGER, imagelink TEXT, chance INTEGER)") - await db.commit() - class speechbubble(commands.Cog): def __init__(self, bot: commands.Bot): - asyncio.run(dbcheck(bot.db,bot.cur)) self.bot = bot bot.add_view(ApplicationView(bot))