1
0
Fork 0
mirror of https://github.com/myned/watcher.git synced 2024-11-01 12:22:38 +00:00

Fix error on webhook events

This commit is contained in:
Myned 2023-03-16 16:55:44 -05:00
parent 0ffc546d34
commit 17cdd3e7b9
No known key found for this signature in database
GPG key ID: 28056631D2CF6B1B

View file

@ -44,8 +44,8 @@ async def on_ready(event):
# Check activity and update timestamp # Check activity and update timestamp
async def update_activity(event, member): async def update_activity(event, member):
# Exclude bots and other guilds # Exclude other guilds
if member.is_bot or event.guild_id != c.config["guild"]: if event.guild_id != c.config["guild"]:
return return
# Exclude and remove activity roles from excluded role # Exclude and remove activity roles from excluded role
@ -69,18 +69,24 @@ async def update_activity(event, member):
# Listener for guild messages # Listener for guild messages
@plugin.listener(hikari.GuildMessageCreateEvent) @plugin.listener(hikari.GuildMessageCreateEvent)
async def on_message(event): async def on_message(event):
# Exclude bots and webhooks
if event.is_human:
await update_activity(event, event.member) await update_activity(event, event.member)
# Listener for guild typing # Listener for guild typing
@plugin.listener(hikari.GuildTypingEvent) @plugin.listener(hikari.GuildTypingEvent)
async def on_typing(event): async def on_typing(event):
# Exclude bots
if not event.member.is_bot:
await update_activity(event, event.member) await update_activity(event, event.member)
# Listener for voice state # Listener for voice state
@plugin.listener(hikari.VoiceStateUpdateEvent) @plugin.listener(hikari.VoiceStateUpdateEvent)
async def on_voice(event): async def on_voice(event):
# Exclude bots
if not event.state.member.is_bot:
await update_activity(event, event.state.member) await update_activity(event, event.state.member)