'discord.py button events in cogs
I want to make a button in a cog but I run into issues with the @buttons.click because I have not made a buttons client. But the ButtonsClient class needs a client argument. I have tried to make the buttons variable in the __init__(self, client): function which takes in a client. I tried to put the buttonsClient inside the init function.
class UserCommands(discord.Cog):
def __init__(self, client):
self.client = client
# I have tried to put the buttons thing here
# buttons = ButtonsClient(client)
# this is where the error is occurring
@buttons.click
async def btn(self):
pass
I use a plugin called discord_buttons_plugin with discord.py.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
