aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/soundchan/Main.java
blob: 0021abad72b59af7e048bf19d3b8c7ea9717025c (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
35
36
37
38
39
40
41
42
43
44
45
package soundchan;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.requests.GatewayIntent;
import soundchan.BotListener.*;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

import static net.dv8tion.jda.api.JDABuilder.createDefault;

public class Main {
  public static void main(String[] args) throws Exception {

    Properties properties = LoadProperties();

    JDA jda = createDefault(properties.getProperty("botToken"))
        .enableIntents(GatewayIntent.GUILD_MESSAGES)
        .addEventListeners(new BotListener(properties))
        .build();
    jda.awaitReady();
  }

  private static Properties LoadProperties(){
    Properties properties = new Properties();
    InputStream input = null;
    try{
      input = new FileInputStream("soundchan.properties");
      properties.load(input);

    }catch (IOException ex){
      ex.printStackTrace();
    } finally {
      try {
        input.close();
      } catch (IOException ex) {
        ex.printStackTrace();
      }
    }
    return properties;
  }

}