[英]How to send a single message to multiple tagged users? (discord.py)
我的機器人中有一個名為“spam”的命令,這樣當有人執行“.spam”時,它會發送一個嵌入警告,不要發送垃圾郵件。 我已經能夠讓機器人在提及用戶的同時發送嵌入。 但是,當我執行“.spam @user1 @user2”時,它確實提到了兩個用戶,但也發送了兩次嵌入,一次用於 user1,另一次用於 user2。
如何使僅發送 1 條消息,並提及用戶數量? 任何幫助將不勝感激。 謝謝你。
這是我在垃圾郵件齒輪中的代碼:
@commands.command()
async def spam(self, ctx, *members: discord.Member):
if members is None:
embed = discord.Embed(
title='',
description='Please do not spam the chat.',
colour=discord.Colour.blue()
)
embed.set_footer(text='')
embed.set_author(name='Mod says:',
icon_url='https://cdn.discordapp.com/avatars/745674627845587004/834f65d2747b1bb8806d12e3791c36bd.webp?size=1024')
await ctx.send(embed=embed)
else:
embed = discord.Embed(
title='',
description='Please do not spam the chat.',
colour=discord.Colour.blue()
)
embed.set_footer(text='')
embed.set_author(name='Mod says:',
icon_url='https://cdn.discordapp.com/avatars/745674627845587004/834f65d2747b1bb8806d12e3791c36bd.webp?size=1024')
for member in members:
await ctx.send(member.mention, embed=embed)
for member in members:
await ctx.send(member.mention, embed=embed)
是問題。 我會做這樣的事情,雖然這不是最好的解決方案。
await ctx.send(" ".join([member.mention for member in members]), embed=embed)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.