Reputation: 33
I want to create a discord bot that erases the message from the channel People left
I tried this:
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'
Upvotes: 1
Views: 162
Reputation: 4225
The event is called on_voice_state_update
, as the name says, it is for Voice channels and VoiceChannel can not be purged as there are no messages in it.
Upvotes: 1