大佬教程收集整理的这篇文章主要介绍了如何在嵌入列表中的单词|不和谐?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想向用户显示列表中的单词,我使用了“for”循环,但此循环发送的消息与列表中的所有单词一样多
例如:3个词在一个列表中,我想发送这三个词一次,但发送了3次
@commands.command(name="showwords")
async def showwords(self,context):
if context.message.author.guild_permissions.administrator:
for word in config.WORDS:
Now_WORD = "\n".join(config.WORDS)
embed = discord.Embed(
title="**ForbIDden words :**",description=f"||{Now_WORD}||\n",color=0x00FF00,)
embed.set_footer(
text=f"requested by {Context.message.author}"
)
embed_message = await context.send(embed=embed)
await embed_message.add_reaction("?")
else:
embed = discord.Embed(
title="Error!",description="You don't have the permission to use this command.",)
embed_message = await context.send(embed=embed)
await embed_message.add_reaction("⛔")
@H_262_12@
我认为是因为
NOW_WORD = "\n".join(config.WORDS)
@H_262_12@
在这里您将所有单词组合成 NOW_WORD
您应该能够在 for 循环中将“word”用作“NOW_WORD”,而不是分配“NOW_WORD”。
以上是大佬教程为你收集整理的如何在嵌入列表中的单词|不和谐?全部内容,希望文章能够帮你解决如何在嵌入列表中的单词|不和谐?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。