首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未发送Discordpy embed

未发送Discordpy embed
EN

Stack Overflow用户
提问于 2020-12-07 16:34:51
回答 1查看 25关注 0票数 0
代码语言:javascript
复制
...on_message():
channel = message.channel

embed = discord.Embed(title=f"**Ok {member_name}**", description=f"Command cancelled. You might get better results with a second read.\n\nOr please see {info_chan} under 'Updating Stats' for other update options.", color=0xcc79a7)
await channel.send(embed=embed)

由于某些原因,这不起作用。我在其他on_message if语句中也有相同的代码,它们可以完美地工作

EN

回答 1

Stack Overflow用户

发布于 2020-12-21 02:22:12

我想我能帮到你!

您的on_message似乎没有被发送,因为您在创建事件时忘记了添加参数(您可以拥有它,但没有显示它)!而且,这种颜色不存在,所以我会仔细检查你的十六进制。下面是你如何解决你的问题:

代码语言:javascript
复制
@bot.event
async def on_message(message): # I defined my message
    channel = message.channel

    embed = discord.Embed(
                    title = f"Okay {message.author.name}#{message.author.discriminator}", 
# I did this only so that way if the event gets called in a private channel ^, 
# you wont get an error (message.author returns abc.User if it's in a private channel.) 
                    description = f"Command cancelled. You might get better results with a second read.\n\nOr please see {info_chan} under 'Updating Stats' for other update options.",
                    color = CC79A7) # did a pink for you
    
    await channel.send(embed=embed)

您可以在此处查看discord.py文档:https://discordpy.readthedocs.io/en/latest/api.html?highlight=embed#discord.Embed.colour

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65178334

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档