我正在制作一個(gè)音樂機(jī)器人,目前我正在添加一個(gè)顯示隊(duì)列中所有歌曲的隊(duì)列命令。upcoming = list(itertools.islice(player.queue._queue, 0, 9))counter = 1for song in upcoming: counter = counter + 1 print(f"{counter}. {song['title']}") embed = discord.Embed(description=f"**{counter}**. [{song['title']}]({song['url']})") embed.set_thumbnail(url=self.bot.user.avatar_url) embed.set_author(name="Playing Next:") await ctx.send(embed=embed)這就是我期望它的樣子:1. Song 12. Song 23. Song 3 4. Song 45. Song 5 6. Song 67. Song 78. Song 89. Song 9相反,它以單獨(dú)的嵌入形式發(fā)送每一行。
1 回答

撒科打諢
TA貢獻(xiàn)1934條經(jīng)驗(yàn) 獲得超2個(gè)贊
您正在創(chuàng)建一個(gè)新的嵌入并為循環(huán)的每次迭代發(fā)送它。在不進(jìn)入列表理解的情況下,最簡(jiǎn)單的解決方案是將所有內(nèi)容移出 for 循環(huán),除了以下內(nèi)容:
embed = discord.Embed(description='')
for song in upcoming:
embed.description += f"**{counter}**. [{song['title']}]({song['url']})\n"
... other embed stuff
... await send embed
添加回答
舉報(bào)
0/150
提交
取消