簡體   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)

以上是我的代碼,它只是給了我一個錯誤:

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
 

它是

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

您必須像在任何其他 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