Discord 不和谐的自我
所以我有一个不和谐的自我机器人。基本上,它只是检查当服务器中的一个人说“@here”时,它会用我选择的消息尽快自动对他们进行dm。我只是想知道,如果有人说@here更快,我该如何进行自我机器人检查。你说的“更快”是什么意思?这是一种检查消息的方法,速度是if语句的两倍。据我所知,搜索字符串(你的代码有)的时间复杂度不会比O(n)高。也。Discord 不和谐的自我,discord,Discord,所以我有一个不和谐的自我机器人。基本上,它只是检查当服务器中的一个人说“@here”时,它会用我选择的消息尽快自动对他们进行dm。我只是想知道,如果有人说@here更快,我该如何进行自我机器人检查。你说的“更快”是什么意思?这是一种检查消息的方法,速度是if语句的两倍。据我所知,搜索字符串(你的代码有)的时间复杂度不会比O(n)高。也。 from discord.ext.commands import Bot from discord.ext import commands import asy
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
#TOKEN
TOKEN = "token"
client = discord.Client()
b = Bot(command_prefix = "!")
@b.event
async def on_ready():
print("on")
@b.event
async def on_message(message):
if "here" in message.content:
try:
await message.author.dm_channel.send("Message I choose")
except:
print('The DM could not be send due to privacy permissions')
b.run(TOKEN, bot = False)