Update
This commit is contained in:
parent
683e182e79
commit
ebb422a984
1 changed files with 9 additions and 2 deletions
|
@ -52,7 +52,15 @@ class rolebutton(commands.Cog):
|
|||
|
||||
@commands.Cog.listener('on_ready')
|
||||
async def roleready(self):
|
||||
self.bot.add_view(RoleView(self.bot))
|
||||
for g in self.bot.guilds:
|
||||
res = await self.bot.cur.execute(f"SELECT roleid FROM rolebutton WHERE serverid = {g.id}")
|
||||
res = await res.fetchall()
|
||||
buttonlist.clear()
|
||||
for [r] in res:
|
||||
role = g.get_role(int(r))
|
||||
button = nextcord.ui.Button(label=role.name, style=nextcord.ButtonStyle.gray, custom_id=f"rolebutton:{role.id}")
|
||||
buttonlist.append(button)
|
||||
self.bot.add_view(RoleView(self.bot))
|
||||
|
||||
@nextcord.slash_command(
|
||||
name="rolebuttons",
|
||||
|
@ -79,7 +87,6 @@ class rolebutton(commands.Cog):
|
|||
buttonlist.clear()
|
||||
for [r] in res:
|
||||
role = interaction.guild.get_role(int(r))
|
||||
role.name
|
||||
button = nextcord.ui.Button(label=role.name, style=nextcord.ButtonStyle.gray, custom_id=f"rolebutton:{role.id}")
|
||||
buttonlist.append(button)
|
||||
await message.edit(view=RoleView(self.bot))
|
||||
|
|
Loading…
Reference in a new issue