Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Logs the user and message to console when an old message is reacted to #271

Merged
merged 2 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions chiya/cogs/listeners/joyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent) ->
embed_dict = joy_embed.embeds[0].to_dict()
embed_dict["color"] = self.generate_color(joy_count=joy_count)
embed = discord.Embed.from_dict(embed_dict)

# Logs the user and message to console if the message is older than the configured limit
time_since_message = (datetime.datetime.now(datetime.timezone.utc) - message.created_at)
if time_since_message.days > config["channels"]["joyboard"]["timeout"]:
log.info(f"{payload.member.name} reacted to a message from {time_since_message.days} days ago - #{message.channel.name}-{message.id}")

self.cache["add"].remove(cache_data)
await joy_embed.edit(
content=f"😂 **{joy_count}** {message.channel.mention}",
Expand Down
5 changes: 5 additions & 0 deletions config.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ channels:
star_limit: 0
channel_id: 000000000000000000
blacklisted: [000000000000000000]
joyboard:
joy_limit: 0
channel_id: 000000000000000000
blacklisted: [000000000000000000]
timeout: 0
reddit:
subreddit: "snackbox"
channel: 000000000000000000
Expand Down