mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-05 16:49:41 +00:00
[FEATURE] Added bugsnag
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.parabot;
|
package org.parabot;
|
||||||
|
|
||||||
|
import com.bugsnag.Client;
|
||||||
import org.parabot.core.Configuration;
|
import org.parabot.core.Configuration;
|
||||||
import org.parabot.core.Core;
|
import org.parabot.core.Core;
|
||||||
import org.parabot.core.Directories;
|
import org.parabot.core.Directories;
|
||||||
@@ -28,6 +29,8 @@ public final class Landing {
|
|||||||
private static String username;
|
private static String username;
|
||||||
private static String password;
|
private static String password;
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
|
Core.initiateBugsnagInstance();
|
||||||
|
|
||||||
parseArgs(args);
|
parseArgs(args);
|
||||||
|
|
||||||
Core.verbose("Debug mode: " + Core.inDebugMode());
|
Core.verbose("Debug mode: " + Core.inDebugMode());
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public class Configuration {
|
|||||||
public static final String GET_RANDOMS = "http://bdn.parabot.org/api/get.php?action=randoms";
|
public static final String GET_RANDOMS = "http://bdn.parabot.org/api/get.php?action=randoms";
|
||||||
public static final String DATA_API = "http://bdn.parabot.org/api/v2/data/";
|
public static final String DATA_API = "http://bdn.parabot.org/api/v2/data/";
|
||||||
public static final String ITEM_API = DATA_API + "items/";
|
public static final String ITEM_API = DATA_API + "items/";
|
||||||
|
public static final String BUGSNAG_API = "d79752cf94dd4beb24c3d312a8609f53";
|
||||||
|
|
||||||
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
|
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.parabot.core;
|
package org.parabot.core;
|
||||||
|
|
||||||
|
import com.bugsnag.Client;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.ParseException;
|
import org.json.simple.parser.ParseException;
|
||||||
import org.parabot.Landing;
|
import org.parabot.Landing;
|
||||||
@@ -36,6 +37,8 @@ public class Core {
|
|||||||
private static Version currentVersion = Configuration.BOT_VERSION;
|
private static Version currentVersion = Configuration.BOT_VERSION;
|
||||||
private static Version latestVersion;
|
private static Version latestVersion;
|
||||||
|
|
||||||
|
private static Client bugsnagInstance;
|
||||||
|
|
||||||
public static void disableValidation() {
|
public static void disableValidation() {
|
||||||
Core.validate = false;
|
Core.validate = false;
|
||||||
}
|
}
|
||||||
@@ -281,6 +284,8 @@ public class Core {
|
|||||||
Core.verbose("Checking for updates...");
|
Core.verbose("Checking for updates...");
|
||||||
validateCache();
|
validateCache();
|
||||||
|
|
||||||
|
setBugsnagVersion();
|
||||||
|
|
||||||
if ((validVersion() && checksumValid()) || (!checksumValid() && currentVersion.compareTo(latestVersion) >= 0)){
|
if ((validVersion() && checksumValid()) || (!checksumValid() && currentVersion.compareTo(latestVersion) >= 0)){
|
||||||
Core.verbose("No updates available.");
|
Core.verbose("No updates available.");
|
||||||
return true;
|
return true;
|
||||||
@@ -290,6 +295,19 @@ public class Core {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void initiateBugsnagInstance() {
|
||||||
|
bugsnagInstance = new Client(Configuration.BUGSNAG_API);
|
||||||
|
bugsnagInstance.setSendThreads(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setBugsnagVersion(){
|
||||||
|
Core.bugsnagInstance.setReleaseStage(currentVersion.compareTo(latestVersion) >= 0 ? "development" : "production");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setBugsnagUser(String id, String email, String username){
|
||||||
|
Core.bugsnagInstance.setUser(id, email, username);
|
||||||
|
}
|
||||||
|
|
||||||
public static void debug(int i) {
|
public static void debug(int i) {
|
||||||
if(mDebug) {
|
if(mDebug) {
|
||||||
System.out.println("DEBUG: " + i);
|
System.out.println("DEBUG: " + i);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.parabot.core.forum;
|
package org.parabot.core.forum;
|
||||||
|
|
||||||
|
import org.parabot.core.Core;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
@@ -31,6 +33,8 @@ public class Account {
|
|||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
|
Core.setBugsnagUser("Null", this.username, "Null");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user