This is the link button i want.
this is my code:
class helpcmd(nextcord.ui.View):
def __init__(self):
super().__init__()
@nextcord.ui.button(label='create thread', style=nextcord.ButtonStyle.link ,url='https://github.com/lmjaedentai/KaiCheng-Bot#commands')
async def help(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
#my code
error:
File "d:\Desktop\coding\discordpy\main.py", line 226, in helpcmd
@nextcord.ui.button(label='create thread', style=nextcord.ButtonStyle.link ,url='https://github.com/lmjaedentai/KaiCheng-Bot#commands')
TypeError: button() got an unexpected keyword argument 'url'
CodePudding user response:
You can't because Discord doesn't return, or support a callback for URL buttons. Instead, you can do it in def __init__
and do self.add_item
. You can check more in the docs.
class SomeView(View):
def __init__(self):
super().__init__() #you can do timeout here
self.add_item(url = "some url", label = "This is a url button") #using this method doesn't have any callback.