Reputation: 45
I am writing a bot for Discord in Python(discordbot.py 0.2.3a3
).
import asyncio
import discord
from discord.ext import commands
from discord.ext.commands import bot
bot = commands.Bot(command_prefix='!')
from discord import FFmpegPCMAudio
from discord.utils import get
@bot.event
async def on_message(msg):
if msg.content == "qwe":
await bot.delete_message(msg)
When I write a command to delete a message, I get the following error:
AttributeError: 'Bot' object has no attribute 'delete_message'
Upvotes: 1
Views: 4628
Reputation: 662
Can you try this:
@bot.event
async def on_message(msg):
if msg.content == "qwe":
await msg.delete()
And see if this works?
Upvotes: 3