Skip to content

Commit

Permalink
Added guild total count to display total guild member after a player …
Browse files Browse the repository at this point in the history
…leaves or joins
  • Loading branch information
KevinTrinh1227 committed Dec 15, 2023
1 parent 9c727bd commit 435a8fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion listeners/general_log_listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ async def on_message_edit(self, message_before, message_after):
embed = discord.Embed(
title=f"✂️ | A message was edited in #{message_before.channel.name}",
description=f"**Old Message:**\n```{message_before.content}```\n**New Message:**\n```{message_after.content} ```",
color=0xFF0000
color=embed_color
)
embed.set_author(name=f"{message_before.author.name} ({message_before.author.display_name})", icon_url=message_before.author.avatar.url)
embed.add_field(name="Message Author", value=message_before.author.mention,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async def guildMemberCacher(self):
if response.status_code == 200:
data = response.json()
members = data['guild']['members']
total_guild_members = len(data['guild']['members'])

# Load existing guild_member_data from JSON file
try:
Expand All @@ -69,14 +70,16 @@ async def guildMemberCacher(self):
uuids_to_remove.append(uuid)

for uuid in uuids_to_remove:
#print(f"Removing {guild_member_data[uuid]} from the JSON.")
# print(f"Removing {guild_member_data[uuid]} from the JSON.")
player_name = guild_member_data["usernames"][uuid]
del guild_member_data["usernames"][uuid]

guild_member_cache_total = len(guild_member_data["usernames"])

channel = self.client.get_channel(logs_channel_id)
embed = discord.Embed(
title=(f"😭 | {player_name} left/got kicked the guild."),
description=f"Player `{player_name}` has been removed from the guild data because they either left the guild or was kicked.",
description=f"Player `{player_name}` has been removed from the guild data because they either left the guild or was kicked.\n\n **Total Guild Members: `{guild_member_cache_total}`/`125`**",
colour= embed_color
)
# embed.timestamp = datetime.datetime.now()
Expand Down Expand Up @@ -105,11 +108,14 @@ async def guildMemberCacher(self):
guild_member_data["usernames"][uuid] = ign
#print(f"{ign} has been added!")

guild_member_cache_total = len(guild_member_data["usernames"])
# print(f"Total: {guild_member_cache_total}")


channel = self.client.get_channel(logs_channel_id)
embed = discord.Embed(
title=(f"😊 | {ign} has just joined the guild!"),
description=f"Player `{ign}` was just loaded into the guild cache. This means that they either just joined or was just now loaded. Their username will now appear in all guild commands.",
description=f"Player `{ign}` was just loaded into the guild cache. This means that they either just joined or was just now loaded. Their username will now appear in all guild commands.\n\n **Total Guild Members: `{guild_member_cache_total}`/`125`**",
colour= embed_color
)
# embed.timestamp = datetime.datetime.now()
Expand Down

0 comments on commit 435a8fd

Please sign in to comment.