"E:Python ProjectsBotvenvScriptspython.exe" "E:/Python Projects/Bot/bot.py"
Bot is Ready.
LuciferMorningstar#1612: Hello
Ignoring exception in on_message_delete
Traceback (most recent call last):
File "C:UsersLuciferAppDataRoamingPythonPython37site-packagesdiscordclient.py", line 312, in _run_event
await coro(args, *kwargs)
TypeError: on_message_delete() missing 1 required positional argument: 'context'
code :
import discord
from discord.ext import commands
TOKEN = 'None'
bot = commands.Bot(command_prefix='$')
@bot.event
async def on_ready():
print('Bot is Ready.')
@bot.event
async def on_message(message):
author = message.author
content = message.content
print('{}: {}'.format(author, content))
@bot.event
async def on_message_delete(message, context):
author = message.author
content = message.content
channel = message.channel
await bot.send_message(channel, '{}: {}'.format(author, content))
bot.run(TOKEN)
Help Me Pls
Firstly, please use code blocks.
Secondly, learn python, or learn reading, that would resolve your issue.
Note to everyone: Please don't answer them as it is easy to find the solution.
async def on_message_delete(message, context):
remove context man
Indeed, use docs.
https://discordpy.readthedocs.io/en/latest/api.html
@helish88 Can you refrain from repeating me? Thanks.
read docs pls
https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message_delete
i'm using this
async def on_raw_message_delete(message):
and it say's
File "E:/Python Projects/Bot/bot.py", line 20, in on_raw_message_delete
author = message.author
AttributeError: 'RawMessageDeleteEvent' object has no attribute 'author'
i am new at python and i am testing with makinga a discord bot
from docs
on_raw_message_delete(payload)
and join discord server and guys will help you
This is not an issue with discord.py.
GitHub issues for this repository should be used to report issues with this library.
They are not a medium for requesting help with Python.
For further help specific to using this library, you should join either the official discord.py server or the Discord API server, as the README recommends.
As referenced and as your errors indicate, on_message_delete is only passed a single message parameter, and the RawMessageDeleteEvent payload object passed to on_raw_message_delete does not have an author attribute.
As also explained, GitHub issues for this repository should be used to report issues with discord.py itself, rather than for requesting help with Python or using the library, and for future questions like this, you should join either the official discord.py server or the Discord API server for help, as the README also links.
For code block usage, see https://docs.github.com/en/free-pro-team@latest/github/writing-on-github/creating-and-highlighting-code-blocks.
Most helpful comment
This is not an issue with discord.py.
GitHub issues for this repository should be used to report issues with this library.
They are not a medium for requesting help with Python.
For further help specific to using this library, you should join either the official discord.py server or the Discord API server, as the README recommends.