i'm making a discord bot with python. I have some issues about running using @client.command and @client.event at the same time. Here is the code: when I comment the @client.event before the on message function, the join command run. This function cause a particular issue, do you know guys where it can come from? Thank you guys
import discord
import random
from discord.utils import get
from discord.ext import commands
@client.command(pass_context=True)
async def join(ctx):
channel = ctx.author.voice.channel
await channel.connect()
@client.command(pass_context=True)
async def leave(ctx):
await ctx.voice_client.disconnect()
@client.event
async def on_ready():
print("We have logged as {0.user}".format(client))
@client.event
async def on_message(message):
user = message.author.id
if message.content.lower() == "!poisson":
await message.delete()
with open('myimage.png', 'rb') as f:
picture = discord.File(f)
await message.channel.send(file=picture)