|
@@ -20,29 +20,37 @@ import org.apache.http.util.EntityUtils;
|
20
|
20
|
|
21
|
21
|
import com.google.gson.Gson;
|
22
|
22
|
|
23
|
|
-import net.dv8tion.jda.api.AccountType;
|
24
|
23
|
import net.dv8tion.jda.api.JDA;
|
25
|
24
|
import net.dv8tion.jda.api.JDABuilder;
|
26
|
|
-import net.dv8tion.jda.api.OnlineStatus;
|
|
25
|
+
|
27
|
26
|
|
28
|
27
|
public class SendJDA {
|
29
|
28
|
|
30
|
|
- public static JDA jda;
|
31
|
|
- public static void main(String[] args) {
|
|
29
|
+ public static void main(String[] args) throws LoginException, InterruptedException {
|
32
|
30
|
// TODO Auto-generated method stub
|
33
|
31
|
List<SentimentalDictionary> dicList = initDatabase();
|
34
|
|
- JDABuilder jb = new JDABuilder(AccountType.BOT);
|
35
|
|
- jb.setAutoReconnect(true);
|
36
|
|
- jb.setStatus(OnlineStatus.DO_NOT_DISTURB);
|
37
|
|
- jb.setToken("NjYzMjgzODYxMTUyNTk1OTkz.XhGROw.Ps3JJIKlEXoE1eah_5OKHwViThY");
|
38
|
|
- jb.addEventListeners(new TListener(dicList));
|
39
|
|
-
|
40
|
|
- try {
|
41
|
|
- jda = jb.build();
|
42
|
|
- } catch (LoginException e) {
|
43
|
|
- // TODO Auto-generated catch block
|
44
|
|
- e.printStackTrace();
|
45
|
|
- }
|
|
32
|
+ // Note: It is important to register your ReadyListener before building
|
|
33
|
+ JDA jda = JDABuilder.createDefault("NjYzMjgzODYxMTUyNTk1OTkz.XhGROw.Ps3JJIKlEXoE1eah_5OKHwViThY")
|
|
34
|
+ .addEventListeners(new TListener(dicList))
|
|
35
|
+ .build();
|
|
36
|
+
|
|
37
|
+ // optionally block until JDA is ready
|
|
38
|
+ jda.awaitReady();
|
|
39
|
+//
|
|
40
|
+// 이전버전
|
|
41
|
+// List<SentimentalDictionary> dicList = initDatabase();
|
|
42
|
+// JDABuilder jb = new JDABuilder(AccountType.BOT);
|
|
43
|
+// jb.setAutoReconnect(true);
|
|
44
|
+// jb.setStatus(OnlineStatus.DO_NOT_DISTURB);
|
|
45
|
+// jb.setToken("NjYzMjgzODYxMTUyNTk1OTkz.XhGROw.Ps3JJIKlEXoE1eah_5OKHwViThY");
|
|
46
|
+// jb.addEventListeners(new TListener(dicList));
|
|
47
|
+//
|
|
48
|
+// try {
|
|
49
|
+// jda = jb.build();
|
|
50
|
+// } catch (LoginException e) {
|
|
51
|
+// // TODO Auto-generated catch block
|
|
52
|
+// e.printStackTrace();
|
|
53
|
+// }
|
46
|
54
|
}
|
47
|
55
|
|
48
|
56
|
public static List<SentimentalDictionary> initDatas() {
|
|
@@ -68,8 +76,8 @@ public class SendJDA {
|
68
|
76
|
List<SentimentalDictionary> dicList = new ArrayList<SentimentalDictionary>();
|
69
|
77
|
Connection connection = null;
|
70
|
78
|
try {
|
71
|
|
- Class.forName("com.mysql.jdbc.Driver");
|
72
|
|
- connection = DriverManager.getConnection("jdbc:mysql://dev-swh.ga:3306/market","root","swhacademy!");
|
|
79
|
+ Class.forName("com.mysql.cj.jdbc.Driver");
|
|
80
|
+ connection = DriverManager.getConnection("jdbc:mysql://183.99.87.90:3306/market?serverTimezone=UTC","root","swhacademy!");
|
73
|
81
|
} catch (SQLException e1) {
|
74
|
82
|
// TODO Auto-generated catch block
|
75
|
83
|
e1.printStackTrace();
|