summaryrefslogtreecommitdiff
path: root/src/main/java/de/romjaki/selfbot/Main.java
blob: 69ccdbc2ad118fe1699faf0d5ec0eeca5b82f6ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package de.romjaki.selfbot;

import net.dv8tion.jda.core.AccountType;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.JDABuilder;
import net.dv8tion.jda.core.exceptions.RateLimitedException;
import net.dv8tion.jda.core.utils.SimpleLog;

import javax.security.auth.login.LoginException;

/**
 * Created by RGR on 21.05.2017.
 */
public class Main {
    private Main() {
        Util.singleton(Main.class);
    }

    public static void main(String[] args) {
        Config c = Config.getConfig(String.join(" ", args));
        JDA jda = null;
        try {
            jda = new JDABuilder(AccountType.CLIENT)
                    .setToken(c.TOKEN)
                    .addEventListener(new MessageListener(c))
                    .buildAsync();
        } catch (LoginException | RateLimitedException e) {
            SimpleLog.getLog("startup").fatal(String.format("Failed to connect: %s", e));
            System.exit(1);
        }

    }

}