mirror of
https://github.com/myned/watcher.git
synced 2024-12-24 13:07:28 +00:00
Add voice state activity
This commit is contained in:
parent
4b5b047203
commit
d40ba7cdb3
1 changed files with 15 additions and 1 deletions
|
@ -36,7 +36,7 @@ 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"]:
|
||||||
return
|
return
|
||||||
|
|
||||||
db[event.author_id] = event.message.timestamp # or datetime.datetime.utcnow()
|
db[event.author_id] = dt.datetime.now(dt.timezone.utc) # or event.message.timestamp
|
||||||
|
|
||||||
if c.config["active"] and c.config["active"] not in event.member.role_ids:
|
if c.config["active"] and 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"])
|
||||||
|
@ -44,6 +44,20 @@ async def on_message(event):
|
||||||
await event.member.remove_role(c.config["inactive"])
|
await event.member.remove_role(c.config["inactive"])
|
||||||
|
|
||||||
|
|
||||||
|
# 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"]:
|
||||||
|
return
|
||||||
|
|
||||||
|
db[event.state.user_id] = dt.datetime.now(dt.timezone.utc)
|
||||||
|
|
||||||
|
if c.config["active"] and c.config["active"] not in event.state.member.role_ids:
|
||||||
|
await event.state.member.add_role(c.config["active"])
|
||||||
|
if c.config["inactive"] and c.config["inactive"] in event.state.member.role_ids:
|
||||||
|
await event.state.member.remove_role(c.config["inactive"])
|
||||||
|
|
||||||
|
|
||||||
def load(bot):
|
def load(bot):
|
||||||
bot.add_plugin(plugin)
|
bot.add_plugin(plugin)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue