在discord.py中将表情符号添加到您自己的嵌入式消息中

时间:2018-11-09 06:27:39

标签: python-3.x discord.py

我想让机器人发送嵌入的消息,然后对其刚刚发送的嵌入消息添加响应。这是一些示例代码:

@client.command()
async def NEO():
    c = {}
    allnames = []
    names = ''
    response = requests.get("https://api.nasa.gov/neo/rest/v1/feed?api_key=DEMOKEY")
    a = response.json()
    element_count = (a['element_count'])
    b = list(a['near_earth_objects'])
    d = dict(a['near_earth_objects'])
    embed = discord.Embed(title="Near Earth Objects",description=f"There are {element_count} NEO's today.",color=0x7a17bb)
    for c in b:
        for e in range(len(d[c])):
            allnames.append(d[c][e]['name'])
    try:
        for i in range(10):
            names += f"**{i+1}**. {allnames[i]}\n"
    except IndexError:
        for i in len(allnames)-1:
            names += f"**{i+1}**. {allnames[i]}\n"
    embed.add_field(name='List:',value=names)
    await client.say(embed=embed)

在发送嵌入的消息embed之后,我希望它与\u25C0\u25B6表情符号一起对刚刚在同一@client.command中发送的消息做出反应。我尝试使用await client.add_reaction(),但不确定将哪个参数作为Message传递。

0 个答案:

没有答案