第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

將表情符號(hào)添加到嵌入消息

將表情符號(hào)添加到嵌入消息

暮色呼如 2022-07-19 16:40:17
我一直在尋找好幾個(gè)小時(shí),但我沒(méi)有發(fā)現(xiàn)為什么這對(duì)我不起作用。這是我的代碼:@bot.command()async def ticket(ctx):  name = "tickets"  category = discord.utils.get(ctx.guild.categories, name=name)  guild = ctx.message.guild  ticket_id = randint(0, 100)  ticket_channel = await guild.create_text_channel(f"ticket-0{ticket_id}", category=category)  embed = discord.Embed(title="Tickets", description="Support will be with you shortly.\nTo close this ticket, react with :lock:.")  await ticket_channel.send(embed=embed)  await bot.add_reaction(embed, emoji=":lock:")  while True:    await bot.wait_for_reaction(emoji="\N{LOCK}", message=embed)    await bot.delete_channel(ticket_channel)這是我得到的錯(cuò)誤:Ignoring exception in command ticket:Traceback (most recent call last):  File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/discord/ext/commands/core.py", line 83, in wrapped    ret = await coro(*args, **kwargs)  File "main.py", line 40, in ticket    await bot.add_reaction(embed, emoji=":lock:")AttributeError: 'Bot' object has no attribute 'add_reaction'任何幫助正在解決這個(gè)問(wèn)題,非常感謝。
查看完整描述

1 回答

?
肥皂起泡泡

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超6個(gè)贊

add_reaction是Message類的方法,而不是Bot. Embed不子類Message。要獲取與您Message關(guān)聯(lián)的對(duì)象,Embed您需要存儲(chǔ)的返回值channel.send(embed=...)


message = await ticket_channel.send(embed=embed)

await message.add_reaction('\N{LOCK}')


查看完整回答
反對(duì) 回復(fù) 2022-07-19
  • 1 回答
  • 0 關(guān)注
  • 100 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)