如何解决如何使Discord机器人检查左语音通道并清除该通道中的消息
我想创建一个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'
解决方法
该事件称为 on_voice_state_update
,顾名思义,该事件用于语音通道,由于其中没有消息,因此无法清除VoiceChannel。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。