Skip to content

Commit

Permalink
Updated Yui to JDA 2.0.0
Browse files Browse the repository at this point in the history
Removed logging in with Email-Pass, now uses token
Bumped version number
  • Loading branch information
DV8FromTheWorld committed Apr 18, 2016
1 parent 2c41e6f commit f5c039d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 34 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -2,7 +2,7 @@ import org.apache.tools.ant.filters.ReplaceTokens

apply plugin: 'java'

def versionObj = new Version(major: 1, minor: 1, revision: 0)
def versionObj = new Version(major: 1, minor: 2, revision: 0)
group = "net.dv8tion"
archivesBaseName = "Yui"
version = "${versionObj.toString()}"
Expand Down Expand Up @@ -73,7 +73,7 @@ repositories {
}

dependencies {
compile "net.dv8tion:JDA:1.3.0_199"
compile "net.dv8tion:JDA:2.0.0_242"
compile "net.lingala.zip4j:zip4j:1.3.2"
compile "com.google.code.gson:gson:2.4"
compile "org.xerial:sqlite-jdbc:3.8.11.2"
Expand Down
21 changes: 7 additions & 14 deletions src/main/java/net/dv8tion/discord/Settings.java
Expand Up @@ -25,28 +25,21 @@
* https://github.com/MCUpdater/RavenBot/blob/master/src/main/java/org/mcupdater/ravenbot/Settings.java
*/
public class Settings {
private String email;
private String password;
private String botToken;
private String proxyHost;
private String proxyPort;
private Boolean useBetaBuilds;
private List<IrcConnectInfo> ircConnectInfos;
private List<BridgeInfo> bridges;

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getPassword() {
return password;
public String getBotToken()
{
return botToken;
}

public void setPassword(String password) {
this.password = password;
public void setBotToken(String botToken)
{
this.botToken = botToken;
}

public String getProxyHost()
Expand Down
12 changes: 3 additions & 9 deletions src/main/java/net/dv8tion/discord/SettingsManager.java
Expand Up @@ -91,8 +91,7 @@ public void saveSettings() {

private Settings getDefaultSettings() {
Settings newSettings = new Settings();
newSettings.setEmail("email");
newSettings.setPassword("password");
newSettings.setBotToken("");
newSettings.setProxyHost("");
newSettings.setProxyPort("8080");
newSettings.setUseBetaBuilds(new Boolean(false));
Expand All @@ -116,14 +115,9 @@ private void checkOldSettingsFile()
{
boolean modified = false;
Settings defaults = getDefaultSettings();
if (settings.getEmail() == null)
if (settings.getBotToken() == null)
{
settings.setEmail(defaults.getEmail());
modified = true;
}
if (settings.getPassword() == null)
{
settings.setPassword(defaults.getPassword());
settings.setBotToken(defaults.getBotToken());
modified = true;
}
if (settings.getUseBetaBuilds() == null)
Expand Down
12 changes: 3 additions & 9 deletions src/main/java/net/dv8tion/discord/Yui.java
Expand Up @@ -103,7 +103,7 @@ private static void setupBot()
{
Settings settings = SettingsManager.getInstance().getSettings();

JDABuilder jdaBuilder = new JDABuilder(settings.getEmail(), settings.getPassword());
JDABuilder jdaBuilder = new JDABuilder().setBotToken(settings.getBotToken());
Database.getInstance();
Permissions.setupPermissions();
ircConnections = new ArrayList<IrcConnection>();
Expand Down Expand Up @@ -169,12 +169,12 @@ private static void setupBot()
}
catch (IllegalArgumentException e)
{
System.out.println("No login details provided! Please give an email and password in the config file.");
System.out.println("No login details provided! Please provide a botToken in the config.");
System.exit(NO_USERNAME_PASS_COMBO);
}
catch (LoginException e)
{
System.out.println("The Email and Password combination provided in the Config.json was incorrect.");
System.out.println("The botToken provided in the Config.json was incorrect.");
System.out.println("Did you modify the Config.json after it was created?");
System.exit(BAD_USERNAME_PASS_COMBO);
}
Expand All @@ -183,12 +183,6 @@ private static void setupBot()
System.out.println("Our login thread was interrupted!");
System.exit(UNABLE_TO_CONNECT_TO_DISCORD);
}
// catch (DiscordFailedToConnectException e)
// {
// System.out.println("We failed to connect to the Discord API. Do you have internet connection?");
// System.out.println("Also double-check your Config.json for possible mistakes.");
// System.exit(UNABLE_TO_CONNECT_TO_DISCORD);
// }
}

private static void relaunchInUTF8() throws InterruptedException, UnsupportedEncodingException
Expand Down

0 comments on commit f5c039d

Please sign in to comment.