Skip to content

Fix member leave event listener not being able to find a thread - #740

Merged
marko-radosavljevic merged 5 commits into
developfrom
bugfix/leave-event-listener
Jan 16, 2023
Merged

marko-radosavljevic merged 5 commits into
developfrom
bugfix/leave-event-listener

Conversation

@Taz03

@Taz03 Taz03 commented Jan 4, 2023

Copy link
Copy Markdown
Contributor

2023-01-04_201747-848x1031_scrot

closes #619

@Taz03 Taz03 added bug Something isn't working priority: normal labels Jan 4, 2023
@Taz03 Taz03 self-assigned this Jan 4, 2023
@Taz03
Taz03 requested review from a team as code owners January 4, 2023 14:55
@Zabuzard

Zabuzard commented Jan 9, 2023

Copy link
Copy Markdown
Member

what is the actual diff? since you renamed, github doesnt show a proper diff... so its hard to review.

@Taz03

Taz03 commented Jan 9, 2023

Copy link
Copy Markdown
Contributor Author

what is the actual diff? since you renamed, github doesnt show a proper diff... so its hard to review.

previously it used db to store authors and thread id, which is good we have all the threads in storage, but on jda side it used cache to search for the threads, which is not ideal coz not all threads are always cached, hence the errors.

now i use retrieveActiveThreads method to get the threads which is not cache based and then i filter it and close the ones made by leaver.

@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.

works, but is there a way to retrieve active threads from a channel? i would prefer an approach like helpForumChannel.retrieveActiveThreads()... to avoid retrieving all and then matching the pattern afterwards.

@Taz03

Taz03 commented Jan 10, 2023

Copy link
Copy Markdown
Contributor Author

works, but is there a way to retrieve active threads from a channel? i would prefer an approach like helpForumChannel.retrieveActiveThreads()... to avoid retrieving all and then matching the pattern afterwards.

actually there is a method but it is a get method not a retrieve method https://javadoc.io/doc/net.dv8tion/JDA/latest/net/dv8tion/jda/api/entities/channel/attribute/IThreadContainer.html#getThreadChannels()

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Zabuzard

Copy link
Copy Markdown
Member

Probably via cache again, since it doesnt return a RestAction, ...?

@Taz03

Taz03 commented Jan 10, 2023

Copy link
Copy Markdown
Contributor Author

Probably via cache again, since it doesnt return a RestAction, ...?

yea most probably its cache, tho the description doesn't talk about that

@marko-radosavljevic marko-radosavljevic changed the title Fixed leave event listener Fix member leave event listener not being able to find a thread Jan 16, 2023
@marko-radosavljevic
marko-radosavljevic merged commit 01d81ae into develop Jan 16, 2023
@marko-radosavljevic
marko-radosavljevic deleted the bugfix/leave-event-listener branch January 16, 2023 10:46
@Zabuzard Zabuzard mentioned this pull request Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: normal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OnGuildLeaveCloseThreadListener warnings on unknown threads

3 participants