mirror of
https://github.com/myned/watcher.git
synced 2024-12-24 13:07:28 +00:00
Add role excluded from activity checks
This commit is contained in:
parent
0e9e71e278
commit
f9acac86f6
2 changed files with 7 additions and 2 deletions
|
@ -14,6 +14,7 @@ db = "watcher.db" # sqlite3 db filepath
|
|||
guild = 0 # guild id to watch
|
||||
active = 0 # active role id
|
||||
inactive = 0 # inactive role id
|
||||
exclude = 0 # role id to exclude from activity checks
|
||||
duration = 0 # time in seconds before considered inactive
|
||||
"""
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ async def on_ready(event):
|
|||
# Listener for guild messages
|
||||
@plugin.listener(hikari.GuildMessageCreateEvent)
|
||||
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
|
||||
|
||||
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
|
||||
@plugin.listener(hikari.VoiceStateUpdateEvent)
|
||||
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
|
||||
|
||||
db[event.state.user_id] = dt.datetime.now(dt.timezone.utc)
|
||||
|
|
Loading…
Reference in a new issue