This commit is contained in:
insert 2024-08-09 17:54:24 -04:00
parent e0dd4fce18
commit 1778fdcacc
Signed by: insert
GPG key ID: A70775C389ACF105
2 changed files with 17 additions and 10 deletions

View file

@ -39,12 +39,26 @@ class rolebutton(commands.Cog):
bot.add_view(RoleView(bot)) bot.add_view(RoleView(bot))
@nextcord.slash_command( @nextcord.slash_command(
name="roletest", name="rolebuttons",
description="check if the buttons work", description="modify role buttons",
) )
async def roletest(self, interaction: nextcord.Interaction): async def rolebuttons(self, interaction: nextcord.Interaction):
return
self.bot.roleguild = interaction.guild self.bot.roleguild = interaction.guild
await interaction.response.send_message(view=RoleView(self.bot)) 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): def setup(bot: commands.Bot):
bot.add_cog(rolebutton(bot)) bot.add_cog(rolebutton(bot))

View file

@ -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)) 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): class speechbubble(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: commands.Bot):
asyncio.run(dbcheck(bot.db,bot.cur))
self.bot = bot self.bot = bot
bot.add_view(ApplicationView(bot)) bot.add_view(ApplicationView(bot))