mirror of
https://github.com/myned/watcher.git
synced 2024-12-24 13:07:28 +00:00
Fix cache miss on startup
This commit is contained in:
parent
f9acac86f6
commit
52c26b34a3
1 changed files with 3 additions and 1 deletions
|
@ -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"])
|
||||
|
|
Loading…
Reference in a new issue