-
Notifications
You must be signed in to change notification settings - Fork 0
BotBlockAPI
The BotBlockAPI is the essential class for handling the information used in the RequestHandler.
The class allows you to...
- Add Botlist sites and their API-tokens. For a list of supported sites, click here
- Set a delay for posting the guild counts.
It is recommended to use the Builder to create an instance.
However, if you have knowledge of what you need to provide and what those values are for, then feel free to use this constructor:
/*
* Sets the Map containing the sites and tokens and also the update interval.
*/
new BotBlockAPI(Map<String, String> authTokens, int updateInterval);
The Builder is an internal class that was made to provide an easy way to set up an instance of BotBlockAPI.
The code could look like this:
BotBlockAPI api = new BotBlockAPI.Builder()
.addAuthToken("BotList1", "Token1")
.addAuthToken("BotList2", "Token2")
.build();
The Builder has the following methods available:
Required? Yes
Values:String
,String
May throw:
NullPointerException
- When either site or token are empty/null
Adds a site and the corresponding token to a Map that will be used for posting the guild counts.
If a value with the same site name is already set, it will be overriden.
You may receive the API-token from the botlist your bot is on.
You have to use this AT LEAST once!
Required? No (If you called
addAuthTokens(String, String)
)
Values:Map<String, String>
May throw:
NullPointerException
- When the provided Map is empty/null
Set the Map directly with the sites and their token.
This will override the ENTIRE Map and all its previous entries!
Required? No (Has a default value of 30)
Values:Integer
May throw:
IllegalArgumentException
- If provided value is less than 2
Sets the delay in which the guild counts should be posted.
The delay cannot be less than 2. This is due to BotBlock's rate limit which is 1 request every 120 seconds.
Required? Yes
Values:None
This will create the BotBlockAPI instance which means it should be called last.
JavaBotBlockAPI - A continued fork of BotBlock4J for the BotBlock API