我目前正在尝试为我的班级不和谐开发一个不和谐机器人。该机器人在服务器上,但是当我使用多个命令时,它将无法正常工作。现在,我有一个亵渎性过滤器,但由于该过滤器正在运行,因此不会再处理我的任何代码。任何帮助表示赞赏。 PS很抱歉我的代码草率。
代码链接图片:访问https://cdn.discordapp.com/attachments/500004377302532100/515019370397827083/Help_Please.JPG
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
Client = discord.Client() #Initialise Client
client = commands.Bot(command_prefix = "?") #Initialise client bot
chat_filter = ["NIGGER", "FAGGOT", "NIGR", "KILLYOURSELF FAGOT", "DAD"]
@client.event
async def on_ready():
print("Bot is online and connected to Discord") #This will be called
机器人连接到服务器时
@client.event
async def on_message(message):
if message.content == "#TakeMeToClassRoom":
await client.send_message(message.channel, "https://classroom.google.com/u/0/h")
@client.event
async def on_message(message):
if message.content.upper().startswith('!DAD'):
userID = message.author.id
await client.send_message(message.channel, "<@%s> Yes Organism?" % (userID))
if message.content.upper().startswith('?SEKOLBOT'):
if message.author.id == "<user id>": #Replace <User ID> with the ID of the user you want to be able to execute this command!
args = message.content.split(" ")
await client.send_message(message.channel, "%s" % (" ".join(args[1:])))
else:
await client.send_message(message.channel, "Whats Up")
if message.content.upper().startswith('!AMIADMIN'):
if "514626902351151115" in [role.id for role in message.author.roles]: #Replace <Role ID> with the ID of the role you want to be able to execute this command
await client.send_message(message.channel, "You are an admin")
else:
await client.send_message(message.channel, "You are not an admin")
@client.event
async def on_message(message):
contents = message.content.split(" ")
for word in contents:
if word.upper() in chat_filter:
await client.delete_message(message)
await client.send_message (message.channel, "**Hey!! Watch Your Profanity**")
client.run("_______________________")