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

Add role excluded from activity checks

This commit is contained in:
Myned 2022-06-14 18:21:49 -05:00
parent 0e9e71e278
commit f9acac86f6
No known key found for this signature in database
GPG key ID: 33790F979F7A28B8
2 changed files with 7 additions and 2 deletions

View file

@ -14,6 +14,7 @@ db = "watcher.db" # sqlite3 db filepath
guild = 0 # guild id to watch guild = 0 # guild id to watch
active = 0 # active role id active = 0 # active role id
inactive = 0 # inactive role id inactive = 0 # inactive role id
exclude = 0 # role id to exclude from activity checks
duration = 0 # time in seconds before considered inactive duration = 0 # time in seconds before considered inactive
""" """

View file

@ -33,7 +33,7 @@ async def on_ready(event):
# 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):
if event.is_bot or event.guild_id != c.config["guild"]: if event.is_bot or event.guild_id != c.config["guild"] or c.config["exclude"] in event.member.role_ids:
return return
db[event.author_id] = dt.datetime.now(dt.timezone.utc) # or event.message.timestamp db[event.author_id] = dt.datetime.now(dt.timezone.utc) # or event.message.timestamp
@ -47,7 +47,11 @@ async def on_message(event):
# 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):
if event.state.member.is_bot or event.guild_id != c.config["guild"]: if (
event.state.member.is_bot
or event.guild_id != c.config["guild"]
or c.config["exclude"] in event.state.member.role_ids
):
return return
db[event.state.user_id] = dt.datetime.now(dt.timezone.utc) db[event.state.user_id] = dt.datetime.now(dt.timezone.utc)