【问题标题】:Buttons In Embed (Discord.py)嵌入按钮 (Discord.py)
【发布时间】:2021-11-29 15:22:08
【问题描述】:

大家好,我一直在尝试制作一个假的 nitro 命令。我在嵌入下制作了一个接受按钮,将用户带到一个链接(prolly 一个巨魔 gif 或图片)。 目前这是代码。

import discord
from discord.ext import commands
from discord_components import *
from discord_buttons_plugin import *


  def __init__(self, client):
    self.client = client
    buttons = ButtonsClient(client)


  @commands.command(name='nitro')
  @commands.has_permissions(ban_members=True)
  async def nitro(self,ctx, member: discord.Member = None):
    if member == None:
      member = ctx.author



    embed = discord.Embed(title = "**You've been gifted a subscription!**", 
                          description = f"||**{member.mention}**|| has gifted you Nitro for **1 month!**",
                          color = 0xc17ce0)

    embed.set_image(url = 'https://media.threatpost.com/wp-content/uploads/sites/103/2021/04/19145523/Discord-Nitro-e1618858537976.png' )

    await buttons.send(
      content = None,
      embed = embed,
      channel = ctx.channel.id,
      components = [
        ActionRow([
          Button(
            style = ButtonType().Link,
            label = "Accept",
            url = "https://c.tenor.com/Bvb1iMhQQUUAAAAC/gorilla-middle-finger.gif"
          )
        ])
      ]
    )

它没有显示任何错误,但命令不起作用。任何想法或建议...

【问题讨论】:

    标签: button discord discord.py embed


    【解决方案1】:

    这些是类似于discord.py 的第 3 方 API。要在 discord.py 中使用交互和按钮,您可以使用 discord 的主版本,可以通过以下方式下载

    pip install -U git+https://github.com/Rapptz/discord.py

    他们的Official Support server 将提供有关这方面的支持。

    【讨论】:

      猜你喜欢
      • 2021-08-16
      • 2022-11-16
      • 2021-12-27
      • 2022-01-11
      • 1970-01-01
      • 1970-01-01
      • 2022-01-01
      • 2020-12-09
      • 2022-01-19
      相关资源
      最近更新 更多