@bot.event
async def on_message(message):
embed = discord.Embed(
title = "anything",
description = f"?? ???? : \n {message.content} \n ||@here||"
)
if message.channel.id == 927235996158922802:
channelO = await bot.fetch_channel(926945495413301290)
await channelO.send(embed)
在這段代碼中,機器人向我發送了這條短信<discord.embeds.Embed object at 0x0000019E83E31D80>而不是嵌入。沒有錯誤。
uj5u.com熱心網友回復:
將最后一行更改為:
await channelO.send(embed=embed)
發生這種情況是因為當您不添加引數時,embed=, files=, etc.它會自動將其作為content=文本訊息使用。因此,discord.py將您的嵌入轉換為string并像短信一樣發送。
查看檔案
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/404867.html
標籤:
