有人能帮我添加这些带有图片的按钮吗?我正在尝试,但无法在python中为discord bot添加图像。在这里,我留下了我的意思的截图:
这是我的密码
from discord import Client
from discord_components import DiscordComponents, Button, ButtonStyle, InteractionType
bot = Client()
@bot.event
async def on_ready():
DiscordComponents(bot)
@bot.event
async def on_message(msg):
if msg.author.bot:
return
await msg.channel.send(
"Content",
components=[
Button(style=ButtonStyle.blue, label="Blue"),
Button(style=ButtonStyle.red, label="Red"),
Button(style=ButtonStyle.URL, label="url", url="https://example.org"),
],
)
res = await bot.wait_for("button_click")
if res.channel == msg.channel:
await res.respond(
type=InteractionType.ChannelMessageWithSource,
content=f'{res.component.label} clicked'
)
bot.run("")
1条答案
按热度按时间tuwxkamq1#
试试看: