TwitchIO:删除频道中的单个消息

TwitchIO: Delete a single message in channel

如何删除用户使用 TwitchIO 发送的单条消息?

@bot.event
async def event_message(ctx):
    await ctx.content.delete() # Does not work
    await ctx.content.remove() # Does not work
    await ctx.channel.timeout(ctx.author, 1) # Does not work

问题比较老,不过我还是会回答的。
Twitchio 不直接支持这一点。
但是您可以在 Twitch Chat 中删除个别消息,请参阅 Twitch IRC 文档。
CLEARMSG (Twitch Commands)
为此,您需要消息 ID。您在消息标签中获取 ID。
Message tags
代码示例:

async def event_message(message):
    if not message.author.name == self.bot.nick:
        message_id = message.tags['id']
        await message.channel.send(f"/delete {message_id}")

如果你想让某人超时,请执行以下操作:

await message.channel.timeout(message.author.name, 120, f"reason")

Twitchio 文档Channel.timeout