簡體   English   中英

如何編輯來自另一個命令的嵌入? (不和諧.py)

[英]How to edit embed that is from another command? (discord.py)

所以我想制作一個建議系統,它有 ?suggest ?accept 和 ?deny 我已經有代碼 ?suggest 但我想知道如何制作 ?deny 和 ?accept

import discord
from discord.ext import commands

client = commands.Bot(command_prefix='test')

@client.command()
async def suggest(ctx, suggestion):
 embed=discord.Embed(title='Suggestion by {ctx.author.mention}, description=suggestion')
 await ctx.send(embed=embed)

client.run(token)

這是建議的代碼,我想要 ?accept embed的顏色更改為綠色並添加一個字段,其中包含“被接受的原因:{reason}”與 ?deny 相同,有人知道嗎?

要編輯消息,您需要獲取消息:

message.id

然后使用: edit_message並創建一個新的嵌入並放入其中。

來源: Python Discordpy 有沒有辦法修改嵌入的消息?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM