import discord
from discord.ext.commands import Bot
from discord.ext import commands+
from discord.utils import get
import time
bot = commands.Bot(command_prefix='r.', description="prefix")
@bot.event
async def on_message_delete(message):
if(message.author != bot.user):
else:
deleted = message.content
channel = bot.get_channel(657899187957923852)
await channel.send(time + '"' + deleted + '"')
第12行else:
中的是无效的语法(未知,第12行)pylint(语法错误)我试图在不是机器人的消息发送时使用到另一个频道ID等于657899187957923852的频道。
对于导入,我不知道我使用了什么以及此命令所必需的内容(已编辑)
答案 0 :(得分:0)
您需要在if
语句下的代码块中添加一些代码。
@bot.event
async def on_message_delete(message):
if(message.author != bot.user):
return
else:
deleted = message.content
channel = bot.get_channel(657899187957923852)
await channel.send(time + '"' + deleted + '"')