From 69d1e147a8d3e0766024ee7fb1b9c5334a2454a9 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Mon, 8 Apr 2024 11:05:16 +0530 Subject: [PATCH 1/3] Explicitly define `user` as `str` type when performing uid match check in message --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 6b82deb..baf4a34 100644 --- a/main.py +++ b/main.py @@ -155,7 +155,7 @@ async def on_message(ctx): for userid in presence[str(ctx.guild.id)].keys(): uList.append(userid) else: pass for user in uList: - if user in ctx.content and not ctx.author.bot: + if str(user) in ctx.content and not ctx.author.bot: fetch_user = client.get_user(id(user)) await ctx.channel.send(f"{fetch_user.display_name} went AFK : {presence[str(ctx.guild.id)][str(user)]['response']}") if str(ctx.guild.id) in presence and str(ctx.author.id) in presence[str(ctx.guild.id)]: From 996e3b22802908bb4df71c65e092be12fa5ad0de Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Mon, 8 Apr 2024 12:33:35 +0530 Subject: [PATCH 2/3] Switch `user` variable type from `id` to `int` --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index baf4a34..e1d4f1d 100644 --- a/main.py +++ b/main.py @@ -156,7 +156,7 @@ async def on_message(ctx): else: pass for user in uList: if str(user) in ctx.content and not ctx.author.bot: - fetch_user = client.get_user(id(user)) + fetch_user = client.get_user(int(user)) await ctx.channel.send(f"{fetch_user.display_name} went AFK : {presence[str(ctx.guild.id)][str(user)]['response']}") if str(ctx.guild.id) in presence and str(ctx.author.id) in presence[str(ctx.guild.id)]: _presence.remove_afk(ctx.guild.id, ctx.author.id) From fd7adcbaeb351bbe69538e4a81e7dbbc751fff85 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:14:31 +0530 Subject: [PATCH 3/3] Switch from client cache to fetching user context data from API --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e1d4f1d..4bc69c6 100644 --- a/main.py +++ b/main.py @@ -156,7 +156,7 @@ async def on_message(ctx): else: pass for user in uList: if str(user) in ctx.content and not ctx.author.bot: - fetch_user = client.get_user(int(user)) + fetch_user = await client.fetch_user(int(user)) await ctx.channel.send(f"{fetch_user.display_name} went AFK : {presence[str(ctx.guild.id)][str(user)]['response']}") if str(ctx.guild.id) in presence and str(ctx.author.id) in presence[str(ctx.guild.id)]: _presence.remove_afk(ctx.guild.id, ctx.author.id)