【发布时间】:2021-09-03 03:50:51
【问题描述】:
我将我的机器人设置为能够具有自定义前缀,现在我希望我的机器人能够在有人提及它时做出响应。当有人 @bot 或 @bot help 时,它都应该响应。
def get_prefix(client, message):
with open('prefixes.json', 'r') as f: ##we open and read the prefixes.json, assuming it's in the same file
prefixes = json.load(f) #load the json as prefixes
return prefixes[str(message.guild.id)] #recieve the prefix for the guild id given
client = commands.Bot(
command_prefix= (get_prefix),
intents = intents
)
【问题讨论】:
标签: python discord.py bots prefix