Skip to content

feat: Added Emoji caching with cleanup and TTL#1523

Closed
Glabay wants to merge 10 commits into
Together-Java:developfrom
Glabay:develop
Closed

feat: Added Emoji caching with cleanup and TTL#1523
Glabay wants to merge 10 commits into
Together-Java:developfrom
Glabay:develop

Conversation

@Glabay

@Glabay Glabay commented Jul 19, 2026

Copy link
Copy Markdown

This replaces the old way of handling reacted messages, keeping track in a local mem cache for 7 days, with an hourly cleanup routine. Using existing information from the original event, no additional REST calls are needed.

Test for validations included with the work

@Glabay
Glabay requested a review from a team as a code owner July 19, 2026 19:43
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

// MessageId with a Map of Emojis and reacted users
// <MessageId, Map<Emoji, Set<UserId>>>
private final Map<Long, Map<String, Set<Long>>> reactions = new ConcurrentHashMap<>();
private final String TJ_BOT_USER_ID = "884898473676271646";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that wont work. what u want is probably sth like jda.getSelfBot(), i guess

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With no ref to jda, how would I do this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass the reference to the constructor and pass jda from Features.java

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getJda() exists on any JDA class. Such as all the event classes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can search for selfbot in the repo and will find plenty of examples :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zabuzard I got this part figured out

Comment on lines +48 to +50
// MessageId with a Map of Emojis and reacted users
// <MessageId, Map<Emoji, Set<UserId>>>
private final Map<Long, Map<String, Set<Long>>> reactions = new ConcurrentHashMap<>();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a Record to represent what ur doing here and get rid of the 2d-map. do you have two keys or two values? put those into a record respectively.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial key is the message ID, then that value is a Map with the emoji as the key, and reacted userIDs as the value

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats not what i mean. im asking about your access patterns to the map. can you use a Map<MessageAndEmoji, User> or would you need a Map<Message, EmojiAndUser> or neither?

Glabay and others added 6 commits July 20, 2026 17:54
Signed-off-by: Glabay <Java_Guru@live.com>
Signed-off-by: Glabay <Java_Guru@live.com>
Signed-off-by: Glabay <Java_Guru@live.com>
Signed-off-by: Glabay <Java_Guru@live.com>
Signed-off-by: Glabay <Java_Guru@live.com>
repositories.add(githubApi.getRepositoryById(repoId));
}
} catch (IOException ex) {
} catch (NoSuchFieldError | IOException ex) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are all these changes coming from. please keep ur PR focused and dont touch "the entire codebase".

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This came from upgrading the JDA to latest version

@Zabuzard Zabuzard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR in its current state is quite chaotic. it contains WAY too much unrelated changes. also, a full JDA update - that defiinitely does not belong in here at all

@Glabay Glabay closed this by deleting the head repository Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants