Class JavalinManager
java.lang.Object
dev.jacrispys.JavaBot.api.libs.utils.JavalinManager
Web-based event listener to exchange Code's through Discord 0Auth
Link to API site: bot.insideagent.pro
Link to API site: bot.insideagent.pro
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
authorizeUser
(net.dv8tion.jda.api.utils.data.DataObject userData) Takes data from theexchangeCode(String)
method to insert into the databaseprotected boolean
exchangeCode
(String code) Http Request builder to exchange the 0Auth code given by discord for credentialsprotected void
initJavalin
(int port) Initializes Javalin server to listen for queriesprotected String
Creates a token using a base 64 encoder that will be sent VIA dm's to the user
-
Constructor Details
-
JavalinManager
public JavalinManager(int port)
-
-
Method Details
-
initJavalin
protected void initJavalin(int port) Initializes Javalin server to listen for queries- Parameters:
port
- port to start the server on
-
exchangeCode
Http Request builder to exchange the 0Auth code given by discord for credentials- Parameters:
code
- code to exchange- Returns:
- True if data was successfully obtained from Discord, false otherwise
-
authorizeUser
protected void authorizeUser(net.dv8tion.jda.api.utils.data.DataObject userData) throws SQLException Takes data from theexchangeCode(String)
method to insert into the database- Parameters:
userData
-DataObject
(json) compiled from the Http request- Throws:
SQLException
- if a database error occurs
-
tokenGenerator
Creates a token using a base 64 encoder that will be sent VIA dm's to the user- Returns:
- the token generated
-