Skip to content

Implement Web API Tokens support

Administrator requested to merge github/fork/NiklasRosenstein/webapi-tokens into master

Created by: NiklasRosenstein

Builds upon #10 -- don't merge this before that PR.

  • Add nullable APITOKEN field to USERS table (ensure that the table is updated before running this version of the bot)
  • Add User.getApiToken(), User.newApiToken(), User.revokeApiToken() and update User.save() and UserService class
  • 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() from CommandExecutionListener.onReady()
  • fix Audio.handleSoundRequest() now that Main.initSounds() saves absolute paths in the database (picked into #10)
  • Add API token check to WebApiCommandHandler and make proper HTTP respones in all cases

Merge request reports

Loading