MCPcopy Create free account
hub / github.com/brainboxdotcc/DPP / main

Function main

docpages/example_code/timers_example2.cpp:3–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include <dpp/dpp.h>
2
3int main() {
4 /* Create the bot */
5 dpp::cluster bot("token");
6
7 bot.on_log(dpp::utility::cout_logger());
8
9 bot.on_ready([&bot](const dpp::ready_t& event) {
10 /* Create a timer when the bot starts. */
11 bot.start_timer([&bot](const dpp::timer& timer) {
12 /* Create a timer when the bot starts. */
13 bot.request("https://dpp.dev/DPP-Logo.png", dpp::m_get, [&bot, timer](const dpp::http_request_completion_t& callback) {
14 /* Create a message to our desired channel, with the D++ logo. */
15 bot.message_create(dpp::message(1140010849432522843, "").add_file("image.png", callback.body));
16 /* Stop the timer by passing the timer handle in. */
17 bot.stop_timer(timer);
18 });
19 }, 10); /* Do it every 10 seconds. Timers also start with this delay. */
20 });
21
22 bot.start(dpp::st_wait);
23}

Callers

nothing calls this directly

Calls 7

cout_loggerFunction · 0.85
start_timerMethod · 0.80
requestMethod · 0.80
message_createMethod · 0.80
stop_timerMethod · 0.80
startMethod · 0.80
messageClass · 0.50

Tested by

no test coverage detected