我正在用Python(discordbot.py 0.2.3a3
)为Discord编写一个机器人。
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)
当我编写删除消息的命令时,出现以下错误:
AttributeError: 'Bot' object has no attribute 'delete_message'
答案 0 :(得分:0)
您能尝试一下吗?
@bot.event
async def on_message(msg):
if msg.content == "qwe":
await msg.delete()
看看是否可行?