use of de.foryasee.httprequest.HttpRequestBuilder in project Rubicon by Rubicon-Bot.
the class MemberLeaveRequestImpl method build.
@Override
public HttpRequestBuilder build() {
HttpRequestBuilder request = new HttpRequestBuilder(WebpanelData.BASE_URL, RequestType.GET);
request.addParameter("type", WebpanelData.MEMBER_LEAVE.getKey());
request.addParameter("guildid", guild.getId());
request.addParameter("guildname", guild.getName());
return request;
}
use of de.foryasee.httprequest.HttpRequestBuilder in project Rubicon by Rubicon-Bot.
the class MessageStatisticsRequestImpl method build.
@Override
public HttpRequestBuilder build() {
HttpRequestBuilder request = new HttpRequestBuilder(WebpanelData.BASE_URL, RequestType.GET);
request.addParameter("type", WebpanelData.MESSAGE_COUNT.getKey());
request.addParameter("guildid", guild.getId());
request.addParameter("guildname", guild.getName());
request.addParameter("count", String.valueOf(size));
return request;
}
use of de.foryasee.httprequest.HttpRequestBuilder in project Rubicon by Rubicon-Bot.
the class CoinhiveManager method getCoinhiveUser.
public static CoinhiveUser getCoinhiveUser(User user) {
try {
HttpRequestBuilder balanceRequest = new HttpRequestBuilder(BASE_URL + "/user/balance", RequestType.GET);
balanceRequest.addParameter("name", user.getId());
RequestResponse balanceResponse = balanceRequest.sendRequest();
JSONObject balanceObj = (JSONObject) new JSONParser().parse(balanceResponse.getResponseMessage());
if (balanceObj.get("success").equals("false") || balanceObj.get("balance") == null) {
return new CoinhiveUser() {
@Override
public String getName() {
return "Invalid user.";
}
@Override
public int getTotal() {
return 0;
}
@Override
public int getWithdrawn() {
return 0;
}
@Override
public long getBalance() {
return 0;
}
};
}
return new CoinhiveUser() {
@Override
public String getName() {
return (String) balanceObj.get("name");
}
@Override
public int getTotal() {
return (int) balanceObj.get("total");
}
@Override
public int getWithdrawn() {
return (int) balanceObj.get("withdrawn");
}
@Override
public long getBalance() {
return ((long) balanceObj.get("balance"));
}
};
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
use of de.foryasee.httprequest.HttpRequestBuilder in project Rubicon by Rubicon-Bot.
the class CoinhiveManager method withdrawUser.
public static void withdrawUser(CoinhiveUser coinhiveUser, int amount) {
try {
HttpRequestBuilder balanceRequest = new HttpRequestBuilder(BASE_URL + "/user/withdraw", RequestType.POST);
balanceRequest.addParameter("name", coinhiveUser.getName());
balanceRequest.addParameter("amount", String.valueOf(amount));
RequestResponse balanceResponse = balanceRequest.sendRequest();
JSONObject balanceObj = (JSONObject) new JSONParser().parse(balanceResponse.getResponseMessage());
if (balanceObj.get("success").equals("false")) {
Logger.error((String) balanceObj.get("error"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of de.foryasee.httprequest.HttpRequestBuilder in project Rubicon by Rubicon-Bot.
the class GuildNameUpdateRequestImpl method build.
@Override
public HttpRequestBuilder build() {
HttpRequestBuilder request = new HttpRequestBuilder(WebpanelData.BASE_URL, RequestType.GET);
request.addParameter("type", "guild_name_update");
request.addParameter("guildid", guild.getId());
request.addParameter("guildname", guild.getName());
return request;
}
Aggregations