This commit is contained in:
insert 2024-08-09 08:59:25 -04:00
parent b331e6a38e
commit 39244363d1
Signed by: insert
GPG key ID: A70775C389ACF105
2 changed files with 8 additions and 7 deletions

View file

@ -8,7 +8,7 @@ from urllib.parse import urlparse
import os
class RoleView(nextcord.ui.View):
def __init__(self,bot: commands.bot):
def __init__(self,bot):
super().__init__(timeout=None)
self.bot = bot
@ -25,7 +25,7 @@ class speechbubble(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
bot.add_view(RoleView())
bot.add_view(RoleView(bot))
@nextcord.slash_command(
name="roletest",
@ -33,7 +33,7 @@ class speechbubble(commands.Cog):
)
async def roletest(self, interaction: nextcord.Interaction, victim: nextcord.Member = nextcord.SlashOption(name="victim")):
self.bot.roleguild = interaction.guild
await interaction.response.send_modal(view=RoleView())
await interaction.response.send_modal(view=RoleView(self.bot))
def setup(bot: commands.Bot):
bot.add_cog(rolebuttons(bot))

View file

@ -9,7 +9,7 @@ import os
class ApplicationView(nextcord.ui.View):
def __init__(self,bot: commands.Bot):
def __init__(self,bot):
super().__init__(timeout=None)
self.bot = bot
@ -53,8 +53,9 @@ class ApplicationView(nextcord.ui.View):
return
class ApplicationModal(nextcord.ui.Modal):
def __init__(self,user):
def __init__(self,user,bot):
self.victim = user
self.bot = bot
super().__init__(
f"create a speechbubble for {user.name}"
)
@ -106,14 +107,14 @@ 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())
await interaction.send(f"<@{self.victim.id}> {interaction.user.name} proposes the following speech bubble for you:", embed=embed, view=ApplicationView(self.bot))
class speechbubble(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
bot.add_view(ApplicationView())
bot.add_view(ApplicationView(bot))
@commands.Cog.listener('on_message')
async def on_message(self,message):