use of com.github.scribejava.core.oauth.OAuth20Service in project legendarybot by greatman.
the class LinkWoWCharsCommand method execute.
@Override
public void execute(MessageReceivedEvent event, String[] args) {
String region = plugin.getBot().getGuildSettings(event.getGuild()).getRegionName();
if (region == null) {
event.getChannel().sendMessage("The Region is not configured. Please ask a server admin to configure it with the setup command").queue();
return;
}
OAuth20Service service = new ServiceBuilder(plugin.getProps().getProperty("battlenetoauth.key")).scope("wow.profile").callback("https://legendarybot.greatmancode.com/auth/battlenetcallback").state(region + ":" + event.getAuthor().getId()).build(new OAuthBattleNetApi(region));
event.getAuthor().openPrivateChannel().queue((privateChannel -> privateChannel.sendMessage("Please follow this link to connect your WoW account to this bot: " + service.getAuthorizationUrl()).queue()));
log.info("User " + event.getAuthor().getName() + ":" + event.getAuthor().getId() + " requested to link his characters. Link generated: " + service.getAuthorizationUrl());
}
Aggregations