Ignoring exception in on_message in pycharm using discord.py
When I type "!hello" in my discord server my bot should say "Hello (author)" But when i run the command this error comes up
Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\Leo\PycharmProjects\untitled\venv\lib\site-packages\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "C:/Users/Leo/PycharmProjects/untitled/Discord-bot.py", line 16, in on_message await message.channel.send('Hello {0.author.mention}'.format(message)) AttributeError: 'Channel' object has no attribute 'send'
I dont know what to do and other things on this website dont do the same thing I did. Heres My Script:
import discord class MyClient(discord.Client): async def on_ready(self): print('Logged in as') print(self.user.name) print(self.user.id) print('------') async def on_message(self, message): # we do not want the bot to reply to itself if message.author.id == self.user.id: return if message.content.startswith('/Hi'): await message.channel.send('Hello {0.author.mention}'.format(message)) client = MyClient() client.run('TOKENWENTHERE')
Turned out i was using discord.py version 0.64! Thanks both @Vate and @MLarionv !