mirror of
https://github.com/myned/watcher.git
synced 2024-11-01 20:22:38 +00:00
Remove state checking
Python does this implicitly
This commit is contained in:
parent
50a6a5eab5
commit
c5376f6c6e
1 changed files with 7 additions and 7 deletions
|
@ -22,14 +22,14 @@ async def check_activity():
|
||||||
) or await plugin.bot.rest.fetch_member(c.config["guild"], author_id)
|
) or await plugin.bot.rest.fetch_member(c.config["guild"], author_id)
|
||||||
|
|
||||||
# Delete member from db if it has excluded role
|
# Delete member from db if it has excluded role
|
||||||
if c.config["exclude"] and c.config["exclude"] in member.role_ids:
|
if c.config["exclude"] in member.role_ids:
|
||||||
del c.db[author_id]
|
del c.db[author_id]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Enforce activity roles
|
# Enforce activity roles
|
||||||
if c.config["active"] and c.config["active"] in member.role_ids:
|
if c.config["active"] in member.role_ids:
|
||||||
await member.remove_role(c.config["active"])
|
await member.remove_role(c.config["active"])
|
||||||
if c.config["inactive"] and c.config["inactive"] not in member.role_ids:
|
if c.config["inactive"] not in member.role_ids:
|
||||||
await member.add_role(c.config["inactive"])
|
await member.add_role(c.config["inactive"])
|
||||||
# Delete member from db if not found
|
# Delete member from db if not found
|
||||||
except hikari.NotFoundError:
|
except hikari.NotFoundError:
|
||||||
|
@ -53,9 +53,9 @@ async def on_message(event):
|
||||||
c.db[event.author_id] = dt.datetime.now(dt.timezone.utc) # or event.message.timestamp
|
c.db[event.author_id] = dt.datetime.now(dt.timezone.utc) # or event.message.timestamp
|
||||||
|
|
||||||
# Toggle activity roles
|
# Toggle activity roles
|
||||||
if c.config["active"] and c.config["active"] not in event.member.role_ids:
|
if c.config["active"] not in event.member.role_ids:
|
||||||
await event.member.add_role(c.config["active"])
|
await event.member.add_role(c.config["active"])
|
||||||
if c.config["inactive"] and c.config["inactive"] in event.member.role_ids:
|
if c.config["inactive"] in event.member.role_ids:
|
||||||
await event.member.remove_role(c.config["inactive"])
|
await event.member.remove_role(c.config["inactive"])
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,9 +74,9 @@ async def on_voice(event):
|
||||||
c.db[event.state.user_id] = dt.datetime.now(dt.timezone.utc) # or event.message.timestamp
|
c.db[event.state.user_id] = dt.datetime.now(dt.timezone.utc) # or event.message.timestamp
|
||||||
|
|
||||||
# Toggle activity roles
|
# Toggle activity roles
|
||||||
if c.config["active"] and c.config["active"] not in event.state.member.role_ids:
|
if c.config["active"] not in event.state.member.role_ids:
|
||||||
await event.state.member.add_role(c.config["active"])
|
await event.state.member.add_role(c.config["active"])
|
||||||
if c.config["inactive"] and c.config["inactive"] in event.state.member.role_ids:
|
if c.config["inactive"] in event.state.member.role_ids:
|
||||||
await event.state.member.remove_role(c.config["inactive"])
|
await event.state.member.remove_role(c.config["inactive"])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue