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

Fix cache miss on startup

This commit is contained in:
Myned 2022-07-05 17:19:25 -05:00
parent f9acac86f6
commit 52c26b34a3
No known key found for this signature in database
GPG key ID: 33790F979F7A28B8

View file

@ -16,7 +16,9 @@ db = sqlitedict.SqliteDict(c.config["db"], tablename=str(c.config["guild"]), aut
async def check_activity():
for author_id, timestamp in db.items():
if dt.datetime.now(dt.timezone.utc) - timestamp >= dt.timedelta(seconds=c.config["duration"]):
member = plugin.bot.cache.get_member(c.config["guild"], author_id)
member = plugin.bot.cache.get_member(c.config["guild"], author_id) or await plugin.bot.rest.fetch_member(
c.config["guild"], author_id
)
if c.config["active"] and c.config["active"] in member.role_ids:
await member.remove_role(c.config["active"])