Closed danbopes closed 6 years ago
https://github.com/danbopes/legendarybot/blob/05dcec530dbb346d11444de2e0a9f9d5920e63b9/api/src/main/java/com/greatmancode/legendarybot/api/utils/BattleNetAPIInterceptor.java#L176 https://github.com/danbopes/legendarybot/blob/05dcec530dbb346d11444de2e0a9f9d5920e63b9/api/src/main/java/com/greatmancode/legendarybot/api/utils/BattleNetAPIInterceptor.java#L168
The bot would break here if someone have only a US key or only a EU key. The code doesn't expect the euService/usService variable to be null there.
One way to fix this is would be that if only 1 of the 2 keys are available, load both from the same key. There's no limitation blizzard side for this. In Production I load 2 keys since in blizzard API EULA, you can use different keys between regions.
I had assumed that if your guild was in a specific region that it would not reach out to the EU api at all. Because you can provide region to some of the commands, this would indeed cause an issue. I've updated the PR to copy over the keys to separate regions.
Fixes #31
Also, for users that are starting the bot on their own, they may not need multiple api keys for different regions. Added a check to skip service creation if the key doesn't exist in the app.properties file.