简体   繁体   English

如何使 discord 机器人不区分大小写并同时收听 ping?

[英]how to make discord bot be case insensitive and listen to pings same time?

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

Above is my code it just gives me an error:以上是我的代码,它只是给了我一个错误:

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
 

It's它是

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

You have to add the normal brackets like in any other function您必须像在任何其他 function 中一样添加普通括号

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM