#My Buttons dont work after restart
1 messages · Page 1 of 1 (latest)
why after i restart my bot the buttons dont work anymore they should normally still work can someone tell me why?
Here's the persistent example.
You need to make them persistent ^
ehm i did?
if you look in the .txt file
?tag codeblock
Please put your code in a code block:
```py
Here is your Code
```
That makes reading code in Discord a lot easier:
print("This is an example.")
Can you just post your code here
yeah
class PersistentView(discord.ui.View):
def __init__(self):
super().__init__(timeout=None)
@discord.ui.button(label="🎟️ Ticket-Support", style=discord.ButtonStyle.blurple, custom_id="ticket_button1")
async def first_button_callback(self, button, interaction):
... my code is to long
class PersistentViewBot(commands.Bot):
def __init__(self):
super().__init__()
self.persistent_views_added = False
async def on_ready(self):
if not self.persistent_views_added:
self.add_view(PersistentView())
self.persistent_views_added = True
bot = PersistentViewBot()
Yeah that all looks right
What version of pycord?
py-cord==2.0.0b7