我最近一直在试图让我的服务器BOT这将有一个命令中,你可以说!ann <channel> <message>
和机器人将张贴在这也将显示在消息的嵌入。
我只能够远远得到这一点,但即使这样也不行。
if message.content.upper().startswith("!ANN"):
if "534116283487223809" in [role.id for role in message.author.roles]:
args = message.content.split(" ")
embed = discord.Embed(title="**9Lounge Announcement**", description="$s" % (" ".join(args[1:])), color=0x0000ff)
await client.send_message(message.channel, embed=embed)
将任何你能帮忙吗?
问候
H
好吧,我得到这个为你工作。随意将其更改为自己的喜好。
@bot.command(ignore_extra=False)
async def sendd(ctx, channel, *message):
color = discord.Color.from_rgb(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
channel = channel.replace('<#', '')
channel = int(channel.replace('>', ''))
channe = bot.get_channel(channel)
message = (" ".join(message[0:]))
embed = discord.Embed(title="Sendd", description=f"{message}", color=color)
await channe.send(embed=embed)
当然,你必须声明机器人为“僵尸”,否则将无法正常工作。这寿为我工作。