Improve registered commands caching
All checks were successful
continuous-integration/drone/push Build is passing

Discord's API is slow in updating and registering new commands, so we set up a runnable to periodically check.
This commit is contained in:
2022-11-21 16:24:09 +01:00
parent b015fddf3c
commit 163619a7f8
4 changed files with 37 additions and 8 deletions

View File

@@ -125,6 +125,9 @@ public class SlashCommandUtil
}
// cache the registered commands.
// note that if this is the first time the bot runs after updating commands,
// this will probably still return the previous configuration because the discord api
// needs to propagate. this is why we also set up a command updater task (ExpiredMessageTask).
Configuration.setRegisteredCommands(jdaInstance.retrieveCommands().complete());
}
}