This repository has been archived by the owner on Sep 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.ts
97 lines (84 loc) · 4.02 KB
/
app.ts
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { KakaoBot } from "./src/KakaoBot";
import { Info, IdCapture } from "./src/Others/Management";
import { DollInfo } from "./src/GirlsFrontline/DollInfo";
import { DollTimetable, EquTimetable } from "./src/GirlsFrontline/TimeTable";
import { ForDeveloper, ForManager, ForUser } from "./src/Others/UtilityCommand";
import { ShiritoriCommand, ShiritoriCore } from "./src/Shiritori/Shiritori";
import { Aquamarine, AquamarineChat } from "./src/Economy/Economy";
import { Management } from "./src/Others/ManageUser";
import { Akagi } from "./src/School/AutoAttendance";
import { scheduleJob } from "node-schedule";
import { CustomSetting } from "./src/Setting";
import { Coral } from "./src/Economy/Coral";
KakaoBot.Taihou.addAction(new KakaoBot.Taihou.Utils.Notice());
KakaoBot.Taihou.addAction(new KakaoBot.Taihou.Channel.Channel());
KakaoBot.Taihou.addAction(new KakaoBot.Taihou.Utils.Join());
KakaoBot.Taihou.addAction(new KakaoBot.Taihou.Utils.Cancel());
KakaoBot.addCommandEvent(new KakaoBot.SystemCommand.Help());
KakaoBot.addCommandEvent(new Coral.Shop.CoralShopCommand());
KakaoBot.addCommandEvent(new Coral.Commands.CoralCommandCore());
KakaoBot.addCommandEvent(new Coral.Commands.CoralCommandAttack());
KakaoBot.addCommandEvent(new Coral.Commands.CoralItemEquip());
KakaoBot.addCommandEvent(new Coral.Commands.CoralItemUse());
KakaoBot.addCommandEvent(new Coral.Commands.CoralLoadMag());
KakaoBot.addCommandEvent(new Coral.Commands.CoralGiveup());
KakaoBot.addCommandEvent(new AquamarineChat.Attendance());
KakaoBot.addChatEvent(new AquamarineChat.ChatExp());
KakaoBot.addCommandEvent(new AquamarineChat.Profile());
KakaoBot.addCommandEvent(new AquamarineChat.Stock());
KakaoBot.addCommandEvent(new AquamarineChat.Transfer());
KakaoBot.addCommandEvent(new AquamarineChat.Management());
KakaoBot.addCommandEvent(new ShiritoriCommand.ShiritoriCommand());
KakaoBot.addCommandEvent(new ShiritoriCommand.ShiritoriAction());
KakaoBot.addChatEvent(new Management.Events.Alart());
KakaoBot.addCommandEvent(new Management.Events.Report());
KakaoBot.addCommandEvent(new Management.Events.Process());
KakaoBot.addCommandEvent(new Management.Events.Hides());
KakaoBot.addCommandEvent(new DollInfo());
KakaoBot.addCommandEvent(new IdCapture());
KakaoBot.addCommandEvent(new Info());
KakaoBot.addCommandEvent(new ForDeveloper.Simulate());
KakaoBot.addCommandEvent(new ForManager.Kick());
KakaoBot.addCommandEvent(new ForUser.CallManager());
KakaoBot.addCommandEvent(new ForUser.HeartReactor());
KakaoBot.addCommandEvent(new ForUser.RandomUser());
KakaoBot.addCommandEvent(new DollTimetable());
KakaoBot.addCommandEvent(new EquTimetable());
KakaoBot.addCommandEvent(new Akagi.AkagiCommand());
KakaoBot.login();
KakaoBot.client.on('login', async () => {
try {
KakaoBot.LogInfo('load shop');
Coral.Shop.Load();
KakaoBot.LogInfo('load shiritori');
await ShiritoriCore.Database.Load();
KakaoBot.LogInfo('load accounts');
await Aquamarine.LoadData();
KakaoBot.LogInfo('load students');
await Akagi.LoadData();
KakaoBot.LogInfo('load settings');
await CustomSetting.LoadData();
KakaoBot.LogInfo('load complate');
KakaoBot.LogInfo(`success login at ${KakaoBot.client.Name}`);
}
catch (e) { KakaoBot.LogError(e); }
});
['SIGINT', 'SIGHUP', 'SIGBREAK', 'SIGBUS']
.forEach((eventType) => {
process.on(eventType, () => { SAVE(); console.log(eventType); process.exit(0); });
});
process.on('uncaughtException', error => { SAVE(); KakaoBot.LogError(error); KakaoBot.LogError(error.stack); process.exit(0); });
process.on('unhandledRejection', reason => { SAVE(); KakaoBot.LogError(reason); });
scheduleJob('autosave', '*/30 * * * *', () => { SAVE(); });
function SAVE() {
try {
KakaoBot.LogInfo('save accounts');
Aquamarine.SaveData();
//KakaoBot.LogInfo('save students');
//Akagi.SaveData();
KakaoBot.LogInfo('save settings');
CustomSetting.SaveData();
KakaoBot.LogInfo('save complate');
}
catch (e) { KakaoBot.LogError(e); }
}