我的命令似乎在 Discord.py 中不起作用
Doesn't seem like my command is working in Discord.py
虽然终端显示命令不存在,但命令已执行。
不知道是怎么回事,因为这是我的第一个 discord 机器人,我知道一点 python,所以很抱歉占用了你们的时间,真的。
谢谢你的帮助!
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix= ':')
game = discord.Game("with the API")
#list of banned words
filtered_words = ['bad words']
@bot.event
async def on_ready():
print("Hello I am online and ready!")
bot.run('token')
#Group message clearing
@bot.command(aliases=['c'])
@commands.has_permissions(manage_messages = True)
async def clear(ctx, amount=1):
await ctx.channel.purge(Limit = amount)
await ctx.reply(f'Deleted {clear} messages')
#auto mod
@bot.event
async def on_message(msg):
for word in filtered_words:
if word in msg.context:
await msg.delete()
await bot.process_commands(msg)
@bot.event
async def on_disconnect():
print("I seem to be getting disconnected, one minute!")
@bot.event
async def on_member_join(memeber):
print(f'Weclome {memeber} to the server, please enjoy your stay!')
@bot.event
async def on_message_delete(msg):
msg.send(" <:raysQ:835686467844964395> ")
bot.run
部分应该在文件末尾。它是s.the循环的入口点。
另外,请在其他人使用之前重新生成您的令牌。
虽然终端显示命令不存在,但命令已执行。 不知道是怎么回事,因为这是我的第一个 discord 机器人,我知道一点 python,所以很抱歉占用了你们的时间,真的。
谢谢你的帮助!
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix= ':')
game = discord.Game("with the API")
#list of banned words
filtered_words = ['bad words']
@bot.event
async def on_ready():
print("Hello I am online and ready!")
bot.run('token')
#Group message clearing
@bot.command(aliases=['c'])
@commands.has_permissions(manage_messages = True)
async def clear(ctx, amount=1):
await ctx.channel.purge(Limit = amount)
await ctx.reply(f'Deleted {clear} messages')
#auto mod
@bot.event
async def on_message(msg):
for word in filtered_words:
if word in msg.context:
await msg.delete()
await bot.process_commands(msg)
@bot.event
async def on_disconnect():
print("I seem to be getting disconnected, one minute!")
@bot.event
async def on_member_join(memeber):
print(f'Weclome {memeber} to the server, please enjoy your stay!')
@bot.event
async def on_message_delete(msg):
msg.send(" <:raysQ:835686467844964395> ")
bot.run
部分应该在文件末尾。它是s.the循环的入口点。
另外,请在其他人使用之前重新生成您的令牌。