Skip to content

Overview cant update if too many questions #533

@Zabuzard

Description

@Zabuzard

Problem

Right now we have so many questions (70) that the message for #active_questions is too long for Discord (>2000 characters). Discord prevents the edit and the action fails:



    tjbot-develop_1  | 2022-08-25T11:19:46.304526000Z java.lang.IllegalStateException: Cannot build a Message with more than 2000 characters. Please limit your input.
    tjbot-develop_1  | 2022-08-25T11:19:46.304816000Z 	at net.dv8tion.jda.api.MessageBuilder.build(MessageBuilder.java:1022) ~[JDA-5.0.0-alpha.9.jar:5.0.0-alpha.9]
    tjbot-develop_1  | 2022-08-25T11:19:46.305012000Z 	at org.togetherjava.tjbot.commands.help.HelpThreadOverviewUpdater.updateOverview(HelpThreadOverviewUpdater.java:139) ~[classes/:?]
    tjbot-develop_1  | 2022-08-25T11:19:46.305217000Z 	at org.togetherjava.tjbot.commands.help.HelpThreadOverviewUpdater.updateOverviewForGuild(HelpThreadOverviewUpdater.java:105) ~[classes/:?]
    tjbot-develop_1  | 2022-08-25T11:19:46.305422000Z 	at net.dv8tion.jda.internal.utils.cache.AbstractCacheView.forEach(AbstractCacheView.java:101) ~[JDA-5.0.0-alpha.9.jar:5.0.0-alpha.9]
    tjbot-develop_1  | 2022-08-25T11:19:46.305614000Z 	at org.togetherjava.tjbot.commands.help.HelpThreadOverviewUpdater.runRoutine(HelpThreadOverviewUpdater.java:69) ~[classes/:?]
    tjbot-develop_1  | 2022-08-25T11:19:46.306132000Z 	at org.togetherjava.tjbot.commands.system.BotCore.lambda$scheduleRoutines$7(BotCore.java:172) ~[classes/:?]
    tjbot-develop_1  | 2022-08-25T11:19:46.306356000Z 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
    tjbot-develop_1  | 2022-08-25T11:19:46.306588000Z 	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
    tjbot-develop_1  | 2022-08-25T11:19:46.306935000Z 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
    tjbot-develop_1  | 2022-08-25T11:19:46.307183000Z 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    tjbot-develop_1  | 2022-08-25T11:19:46.307430000Z 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    tjbot-develop_1  | 2022-08-25T11:19:46.307664000Z 	at java.lang.Thread.run(Thread.java:833) ~[?:?]
    tjbot-develop_1  | 2022-08-25T11:20:46.302391000Z 11:20:46.294 [pool-3-thread-1] ERROR org.togetherjava.tjbot.commands.system.BotCore - Unknown error in routine HelpThreadOverviewUpdate

As a result, our question overview rots and gets no updates anymore.

Workaround

The only way to work around this is by actively closing threads until its below the limit again.

On the good note, the system heals itself once the message is small enough again.

Approach

We have to find a solution to this problem. Unfortunately, I can not think of a very simple one.

Possibilities:

  • Divide the question into multiple messages, disadvantages: Makes finding and editing the question more cumbersome
  • See if we can use embeds to bypass the limit (one embed per category?) - the original reason we did not use embeds is because links in embeds could not be clicked on mobile (Android). The latest update to Android might have fixed that though.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority: normalvalidThis issue/PR is validated and ready to be picked. This auto adds items to TJ project board.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions