I am making a bot for discord and I ran into a problem that the bot does not start, I would appreciate it if you could help me). The bot was created in python
# -*- coding: utf-8 -*-
import discord
from discord.ext import commands
from config import token
import youtube_dl
import os
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
print('bot online!')
@bot.event()
async def on_message():
print('New Message!')
bot.run(token)
CodePudding user response:
You should use @bot.event
decorator for events. Not @bot.event()
.
Also on_message
function should has 1 argument. So, you need to write `
@bot.event
async def on_message(message):
pass # whatever here