Update
This commit is contained in:
parent
2dc257466b
commit
49105886ec
1 changed files with 5 additions and 2 deletions
|
@ -6,12 +6,14 @@ import aiosqlite as sqlite3
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import os
|
import os
|
||||||
|
buttonlist = []
|
||||||
|
|
||||||
class RoleView(nextcord.ui.View):
|
class RoleView(nextcord.ui.View):
|
||||||
def __init__(self,bot):
|
def __init__(self,bot):
|
||||||
super().__init__(timeout=None)
|
super().__init__(timeout=None)
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
for b in buttonlist:
|
||||||
|
self.add_item(b)
|
||||||
#res = await self.bot.cur.execute(f"SELECT roleid FROM rolebutton WHERE serverid = {self.bot.roleguild.id}")
|
#res = await self.bot.cur.execute(f"SELECT roleid FROM rolebutton WHERE serverid = {self.bot.roleguild.id}")
|
||||||
button = nextcord.ui.Button(label="Test", style=nextcord.ButtonStyle.gray, custom_id="rolebutton:821095192831852554")
|
button = nextcord.ui.Button(label="Test", style=nextcord.ButtonStyle.gray, custom_id="rolebutton:821095192831852554")
|
||||||
button.callback = self.buttoncallback
|
button.callback = self.buttoncallback
|
||||||
|
@ -65,10 +67,11 @@ class rolebutton(commands.Cog):
|
||||||
return
|
return
|
||||||
res = await self.bot.cur.execute(f"SELECT roleid FROM rolebutton WHERE serverid = {interaction.guild.id}")
|
res = await self.bot.cur.execute(f"SELECT roleid FROM rolebutton WHERE serverid = {interaction.guild.id}")
|
||||||
res = await res.fetchall()
|
res = await res.fetchall()
|
||||||
|
buttonlist.clear()
|
||||||
for r in res:
|
for r in res:
|
||||||
button = nextcord.ui.Button(label="r", style=nextcord.ButtonStyle.gray, custom_id=f"rolebutton:{r}")
|
button = nextcord.ui.Button(label="r", style=nextcord.ButtonStyle.gray, custom_id=f"rolebutton:{r}")
|
||||||
button.callback = RoleView.buttoncallback
|
button.callback = RoleView.buttoncallback
|
||||||
RoleView.add_item(RoleView,button)
|
buttonlist.append(button)
|
||||||
await message.edit(view=RoleView(self.bot))
|
await message.edit(view=RoleView(self.bot))
|
||||||
await interaction.response.send_message("Edited!", ephemeral=True)
|
await interaction.response.send_message("Edited!", ephemeral=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue