Skip to content

Commit 2b401a0

Browse files
Update button_roles.py
In this new version of the file, the sample IDs have been removed so that people do not come and ask the server why the code is giving an error (which often happens in new developers who copy and paste the codes).
1 parent b4421a1 commit 2b401a0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

examples/views/button_roles.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
"""
1313

1414
# this is the list of role IDs that will be added as buttons.
15-
role_ids = [
16-
846383888003760217, 846383888036134932
17-
]
15+
role_ids = [ ]
1816

1917

2018
class RoleButton(discord.ui.Button):
@@ -65,7 +63,7 @@ def __init__(self, bot):
6563
self.bot = bot
6664

6765
# make sure to set the guild ID here to whatever server you want the buttons in
68-
@slash_command(guild_ids=[846383887973482516], description="Post the button role message")
66+
@slash_command(guild_ids=[], description="Post the button role message")
6967
async def post(self, ctx: commands.Context):
7068
"""Slash command to post a new view with a button for each role
7169
"""
@@ -91,7 +89,7 @@ async def on_ready(self):
9189
# we recreate the view as we did in the /post command
9290
view = discord.ui.View(timeout=None)
9391
# make sure to set the guild ID here to whatever server you want the buttons in
94-
guild = self.bot.get_guild(846383887973482516)
92+
guild = self.bot.get_guild()
9593
for role_id in role_ids:
9694
role = guild.get_role(role_id)
9795
view.add_item(RoleButton(role))

0 commit comments

Comments
 (0)