我正在制作一個音樂機器人,目前我正在添加一個顯示隊列中所有歌曲的隊列命令。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相反,它以單獨的嵌入形式發送每一行。
1 回答

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