-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
84 lines (73 loc) · 2.35 KB
/
main.cpp
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
/************************************************************************************
*
* The Seven Spells Of Destruction
*
* Copyright 1993,2001,2023 Craig Edwards <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
************************************************************************************/
#include <dpp/dpp.h>
#include <ssod/listeners.h>
#include <ssod/database.h>
#include <ssod/logger.h>
#include <ssod/config.h>
#include <ssod/game.h>
#include <ssod/js.h>
#include <ssod/aes.h>
#include <ssod/commandline.h>
#include <ssod/lang.h>
#include <ssod/sentry.h>
int main(int argc, char const *argv[]) {
std::setlocale(LC_ALL, "en_GB.UTF-8");
config::init("../config.json");
logger::init(config::get("log"));
commandline_config cli = commandline::parse(argc, argv);
dpp::cluster bot(
config::get("token"),
dpp::i_guilds,
config::get("shards"),
cli.cluster_id,
cli.max_clusters,
true,
dpp::cache_policy::cpol_none
);
sentry::init(bot);
i18n::load_lang(bot);
if (cli.display_commands) {
std::cerr << listeners::json_commands(bot) << "\n";
exit(0);
}
bot.set_websocket_protocol(dpp::ws_etf);
security::init(bot);
js::init(
bot,
config::exists("js_thread_pool_size") ?
config::get("js_thread_pool_size").get<int>() :
std::thread::hardware_concurrency()
);
bot.on_log(&logger::log);
bot.on_guild_create(&listeners::on_guild_create);
bot.on_guild_delete(&listeners::on_guild_delete);
bot.on_slashcommand(&listeners::on_slashcommand);
bot.on_entitlement_create(&listeners::on_entitlement_create);
bot.on_entitlement_update(&listeners::on_entitlement_update);
bot.on_entitlement_delete(&listeners::on_entitlement_delete);
bot.on_button_click(&game_nav);
bot.on_select_click(&game_select);
bot.on_form_submit(&game_input);
bot.on_ready(&listeners::on_ready);
db::init(bot);
/* Start bot */
bot.start(dpp::st_wait);
}