29
src/main.cc
Normal file
29
src/main.cc
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <cstdlib>
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
const char *
|
||||
get_bot_token () {
|
||||
return getenv ("BOT_TOKEN");
|
||||
}
|
||||
|
||||
int
|
||||
main () {
|
||||
dpp::cluster bot (get_bot_token ());
|
||||
|
||||
bot.on_log (dpp::utility::cout_logger ());
|
||||
|
||||
bot.on_slashcommand ([] (const dpp::slashcommand_t &event) {
|
||||
if (event.command.get_command_name () == "ping") {
|
||||
event.reply ("Pong!");
|
||||
}
|
||||
});
|
||||
|
||||
bot.on_ready ([&bot] (const dpp::ready_t &_) {
|
||||
if (dpp::run_once<struct register_bot_commands> ()) {
|
||||
bot.global_command_create (
|
||||
dpp::slashcommand ("ping", "Ping pong!", bot.me.id));
|
||||
}
|
||||
});
|
||||
|
||||
bot.start (dpp::st_wait);
|
||||
}
|
15
src/meson.build
Normal file
15
src/meson.build
Normal file
@@ -0,0 +1,15 @@
|
||||
sources = files(
|
||||
'main.cc',
|
||||
)
|
||||
|
||||
dpp = dependency('dpp', version: '>=10.1.2', static: true)
|
||||
libavformat = dependency('libavformat', version: '>=61.7.100')
|
||||
libavcodec = dependency('libavcodec', version: '>=61.19.101')
|
||||
|
||||
executable(
|
||||
'singh5',
|
||||
sources,
|
||||
dependencies: [ dpp, libavformat, libavcodec ],
|
||||
install : true,
|
||||
cpp_args: lib_cpp_args
|
||||
)
|
Reference in New Issue
Block a user