這是我想要的鏈接按鈕。

這是我的代碼:
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
錯誤:
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'
uj5u.com熱心網友回復:
你不能,因為 Discord 不回傳,或者支持 URL 按鈕的回呼。相反,你可以在里面做,def __init__然后做self.add_item。您可以在檔案中查看更多資訊。
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.
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/396304.html
