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'
Can you try this:
@bot.event
async def on_message(msg):
if msg.content == "qwe":
await msg.delete()
And see if this works?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.