Когда я набираю «! Hello» на моем сервере Discord, мой бот должен сказать «Привет (автор)». Но когда я запускаю команду, появляется эта ошибка.
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'
Я не знаю, что делать и другие вещи на этом сайте не делают того же, что и я. Вот мой сценарий:
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')