我正在尝试检查从哪个服务器调用命令,以便我可以向不同的服务器发送不同的响应
我想要这样的东西,但我不知道如何实现
@bot.event
async def on_message(message):
# get the server's id in which the message was sent
guild = discord.guild
# one of my server's id
server1_ID = bot.get_guild(865307645434658856)
if guild == server1_ID:
if message.content.startswith('!Ping Roles'):
embedVar = discord.Embed(
title="Ping Roles",
description="",
color=discord.Color.blue(),
)
await message.channel.send(embed=embedVar)
答案 0 :(得分:0)
discord.guild
是整个模块,你想得到一个 discord.Guild
guild = message.guild
server1 = bot.get_guild(865307645434658856)
if guild == server1:
...