我想创建一个discord bot,以清除来自“ People left”频道的消息
我尝试过:
if before.channel:
for role in serverroles:
rooles.append(get(self.guild.roles, name=role))
await self.remove_roles(*rooles)
if before.channel.members == []:
chn = before.channel.id
if chn == 743323003932115076:
channels = client.get_channel(ch1)
await channels.purge(limit=999)
if chn == 743323035200913509:
channels = client.get_channel(ch2)
await channels.purge(limit=999)
if chn == 743323078725075064:
channels = client.get_channel(ch3)
await channels.purge(limit=999)
if chn == 743323177500803094:
channels = client.get_channel(ch4)
await channels.purge(limit=999)```
and I got AttributeError: 'VoiceChannel' object has no attribute 'purge'
答案 0 :(得分:1)
该事件称为 on_voice_state_update
,顾名思义,该事件用于语音通道,由于其中没有消息,因此无法清除VoiceChannel。