You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在使用Discord.py开发的Discord机器人中添加About板块?

Discord.py 机器人About Me板块实现指南

你要实现的对应效果可以直接通过discord.py内置的Embed类完成,完整实现逻辑如下:

效果示例图


实现步骤

  • 首先确认你使用的是discord.py v2.0及以上版本,避免API不兼容问题
  • 在对应指令的回调函数中初始化Embed对象,配置卡片基础属性即可,示例代码如下:
import discord
from discord.ext import commands

# 示例为斜杠指令 /about
@commands.slash_command(name="about", description="查看机器人关于信息")
async def about(ctx: discord.ApplicationContext):
    # 初始化Embed卡片
    embed = discord.Embed(
        title="🤖 关于我",
        description="这里填写机器人简介,可包含功能定位、开发背景等内容",
        color=discord.Color.blue() # 可自定义卡片侧边的配色
    )
    # 添加字段,可根据需求调整增删、修改inline参数控制是否同行展示
    embed.add_field(name="开发者", value="你的昵称/团队名", inline=True)
    embed.add_field(name="版本号", value="v1.0.0", inline=True)
    embed.add_field(name="上线时间", value="2024年1月1日", inline=True)
    embed.add_field(name="核心功能", value="· 内容管理\n· 音乐播放\n· 定时提醒", inline=False)
    # 可选配置:添加页脚、机器人头像缩略图
    embed.set_footer(text="© 2024 你的开发标识")
    embed.set_thumbnail(url=ctx.bot.user.avatar.url)
    
    # 发送About Me卡片
    await ctx.respond(embed=embed)
  • 如果你使用的是前缀指令而非斜杠指令,只需要调整指令的装饰器和入参写法即可,Embed的配置逻辑完全通用

如果需要和示例图完全匹配的布局,只需要对应调整字段的数量、名称、内容,以及inline的开关状态即可。

内容的提问来源于stack exchange,提问作者Soumyajoy Das

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.29 19:06:05