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:
parent
0ffc546d34
commit
17cdd3e7b9
1 changed files with 11 additions and 5 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue