如何使discord bot不区分大小写并同时侦听ping?

2024-09-27 19:12:06 发布

您现在位置:Python中文网/ 问答频道 /正文

client = commands.Bot(command_prefix=commands.when_mentioned_or['S!', 's!'], case_insensitive=True)

上面是我的代码,它只是给了我一个错误:

Traceback (most recent call last):
  File "main.py", line 28, in <module>
    client = commands.Bot(command_prefix=commands.when_mentioned_or['S!', 's!'], case_insensitive=True)
TypeError: 'function' object is not subscriptable
 
KeyboardInterrupt
 

Tags: or代码clienttruemostprefixbot错误
1条回答
网友
1楼 · 发布于 2024-09-27 19:12:06

它是

commands.when_mentioned_or(['S!', 's!'])

您必须像在任何其他函数中一样添加普通方括号

bot = commands.Bot(command_prefix=commands.when_mentioned_or('s!'), case_insensitive=True)

相关问题 更多 >

    热门问题