From b331e6a38ec0a916181c601181459915b35729e4 Mon Sep 17 00:00:00 2001 From: insert Date: Fri, 9 Aug 2024 08:51:22 -0400 Subject: [PATCH] update --- rolebuttons.py | 5 +++-- speechbubble.py | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rolebuttons.py b/rolebuttons.py index 507ad55..a095818 100644 --- a/rolebuttons.py +++ b/rolebuttons.py @@ -8,7 +8,7 @@ from urllib.parse import urlparse import os class RoleView(nextcord.ui.View): - def __init__(self,bot,guild): + def __init__(self,bot: commands.bot): super().__init__(timeout=None) self.bot = bot @@ -32,7 +32,8 @@ class speechbubble(commands.Cog): description="check if the buttons work", ) async def roletest(self, interaction: nextcord.Interaction, victim: nextcord.Member = nextcord.SlashOption(name="victim")): - await interaction.response.send_modal(view=RoleView(self.bot,interaction.guild)) + self.bot.roleguild = interaction.guild + await interaction.response.send_modal(view=RoleView()) def setup(bot: commands.Bot): bot.add_cog(rolebuttons(bot)) \ No newline at end of file diff --git a/speechbubble.py b/speechbubble.py index 2b63b33..5f3d602 100644 --- a/speechbubble.py +++ b/speechbubble.py @@ -9,7 +9,7 @@ import os class ApplicationView(nextcord.ui.View): - def __init__(self,bot): + def __init__(self,bot: commands.Bot): super().__init__(timeout=None) self.bot = bot @@ -53,9 +53,8 @@ class ApplicationView(nextcord.ui.View): return class ApplicationModal(nextcord.ui.Modal): - def __init__(self,user,bot): + def __init__(self,user): self.victim = user - self.bot = bot super().__init__( f"create a speechbubble for {user.name}" ) @@ -107,7 +106,7 @@ class ApplicationModal(nextcord.ui.Modal): value=self.chance.value, inline=False, ) - await interaction.send(f"<@{self.victim.id}> {interaction.user.name} proposes the following speech bubble for you:", embed=embed, view=ApplicationView(self.bot)) + await interaction.send(f"<@{self.victim.id}> {interaction.user.name} proposes the following speech bubble for you:", embed=embed, view=ApplicationView()) class speechbubble(commands.Cog): @@ -115,7 +114,7 @@ class speechbubble(commands.Cog): def __init__(self, bot: commands.Bot): self.bot = bot bot.add_view(ApplicationView()) - + @commands.Cog.listener('on_message') async def on_message(self,message): res = await self.bot.cur.execute(f"SELECT imagelink, chance FROM userinfo WHERE serverid = {message.guild.id} AND userid = {message.author.id} ORDER BY RANDOM() LIMIT 1")