Implement Web API Tokens support
Created by: NiklasRosenstein
Builds upon #10 -- don't merge this before that PR.
- Add nullable
APITOKENfield toUSERStable (ensure that the table is updated before running this version of the bot) - Add
User.getApiToken(),User.newApiToken(),User.revokeApiToken()and updateUser.save()andUserServiceclass - Add
!hydra token <cmd>command that can only be used in a private channel with the bot-
!hydra token show-- Shows your current token. -
!hydra token new-- Generates a new token for you. -
!hydra token revoke-- Revokes your current token.
-
- Move Discord client and user initialization to
Main.initDiscordClientWhenReady()fromCommandExecutionListener.onReady() - fix
Audio.handleSoundRequest()now thatMain.initSounds()saves absolute paths in the database (picked into #10) - Add API token check to
WebApiCommandHandlerand make proper HTTP respones in all cases