使 Discord.py bot 不区分大小写

时间:2021-02-17 08:43:34

标签: discord client discord.py

是否可以在 Discord 客户端上使用 const handleSlide = () => { setInterval(() => { console.log('runs'); }, 2000); }; useEffect(() => { window.addEventListener('load', handleSlide); return () => { return window.removeEventListener('load', handleSlide); }; }, []); 属性?我希望这样,即使用户调用的命令包含大写或小写,我的机器人也可以响应任何命令。

2 个答案:

答案 0 :(得分:1)

case_insensitive 属性不会在 botclient 之间违抗,即使如此,更改它也不难。他们都能够使用这个属性。您可以通过在您的 client

client = commands.Bot(command_prefix = "your prefix", case_insensitive=True)

在同一行上定义您的客户也更容易,而不仅仅是执行 discord.Client()

答案 1 :(得分:0)

查看 discord.ext.commands.Bot 的属性:https://discordpy.readthedocs.io/en/latest/ext/commands/api.html?highlight=sensitive#bot

查看 discord.Client 的属性:
https://discordpy.readthedocs.io/en/latest/api.html?highlight=discord%20client#client

属性 cse_insensitive 是为机器人列出的,而不是为客户端列出的。它在客户端中不存在。这意味着这是不可能的。