我收到以下错误:
Traceback (most recent call last):
File "main.py", line 41, in <module>
@bot.event()
TypeError: event() missing 1 required positional argument: 'coro'
Run Code Online (Sandbox Code Playgroud)
我的代码:
主文件
#------importing packages
import keep_alive
import os
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix = '-', case_insensitive=True)
my_token = os.environ['Token']
#------When bot is online
@bot.event
async def on_ready():
#status
#playing game status
await bot.change_presence(activity=discord.Game(
name=f'On {len(bot.guilds)} Servers | -help'))
print('Bot is Ready')
@bot.event()
async def on_message(message):
# if message.content.startswith(bot.user.mentioned_in(message)):
# await message.channel.send('My prefix is `-`')
if …Run Code Online (Sandbox Code Playgroud)