droplet
1.3.0
A multipurpose Discord bot with the hacker in mind
Toggle main menu visibility
Loading...
Searching...
No Matches
Core.hpp
Go to the documentation of this file.
1
/*
2
* (c) Copyright erarnitox.de - All rights reserved
3
* Author: Erarnitox <david@erarnitox.de>
4
*
5
* License: MIT License
6
*
7
* Description: Discord helper utilities used by commands. Intentionally does
8
* not include Database or command interfaces (stable, minimal core surface).
9
*/
10
11
#pragma once
12
13
#include <dpp/dpp.h>
14
#include <dpp/misc-enum.h>
15
16
#include <string>
17
#include <string_view>
18
19
class
Core
{
20
public
:
21
static
bool
is_admin
(
const
dpp::guild_member& member)
noexcept
;
22
23
static
bool
is_erarnitox_admin
(
const
dpp::guild_member& member)
noexcept
;
24
25
static
std::string
get_role_id
(
const
std::string& mention)
noexcept
;
26
27
static
std::string
get_channel_id
(
const
std::string& mention)
noexcept
;
28
29
static
void
timed_reply
(dpp::cluster& bot,
30
const
dpp::slashcommand_t& event,
31
const
std::string& message,
32
size_t
time_mills)
noexcept
;
33
34
static
void
timed_reply
(dpp::cluster& bot,
35
const
dpp::form_submit_t& event,
36
const
std::string& message,
37
size_t
time_mills)
noexcept
;
38
39
static
void
timed_reply_private
(dpp::cluster& bot,
40
const
dpp::slashcommand_t& event,
41
const
std::string& message,
42
size_t
time_mills)
noexcept
;
43
44
static
void
timed_reply_private
(dpp::cluster& bot,
45
const
dpp::form_submit_t& event,
46
const
std::string& message,
47
size_t
time_mills)
noexcept
;
48
49
[[nodiscard]]
static
std::string
get_parameter
(dpp::cluster& bot,
50
const
dpp::slashcommand_t& event,
51
const
std::string& name,
52
bool
required =
true
)
noexcept
;
53
54
[[nodiscard]]
static
std::string
simple_hash
(std::string_view
string
)
noexcept
;
55
56
[[nodiscard]]
static
std::string
strip_broadcast_mentions
(std::string_view text);
57
58
static
void
disable_all_mentions
(dpp::message& message)
noexcept
;
59
};
Core
Definition
Core.hpp:19
Core::is_erarnitox_admin
static bool is_erarnitox_admin(const dpp::guild_member &member) noexcept
checks if a guild member is admin erarnitox's server
Definition
Core.cpp:43
Core::timed_reply_private
static void timed_reply_private(dpp::cluster &bot, const dpp::slashcommand_t &event, const std::string &message, size_t time_mills) noexcept
replies to an event and displays the reply for a limited time and only to the sender of the event
Definition
Core.cpp:184
Core::simple_hash
static std::string simple_hash(std::string_view string) noexcept
a very simply hashing function
Definition
Core.cpp:240
Core::is_admin
static bool is_admin(const dpp::guild_member &member) noexcept
checks if a guild member is admin of that guild
Definition
Core.cpp:27
Core::timed_reply
static void timed_reply(dpp::cluster &bot, const dpp::slashcommand_t &event, const std::string &message, size_t time_mills) noexcept
replies to an event and displays the reply for a limited time
Definition
Core.cpp:127
Core::disable_all_mentions
static void disable_all_mentions(dpp::message &message) noexcept
Definition
Core.cpp:278
Core::get_parameter
static std::string get_parameter(dpp::cluster &bot, const dpp::slashcommand_t &event, const std::string &name, bool required=true) noexcept
get the parameter from a slash command
Definition
Core.cpp:216
Core::get_channel_id
static std::string get_channel_id(const std::string &mention) noexcept
get the id of a channel from a mention
Definition
Core.cpp:83
Core::get_role_id
static std::string get_role_id(const std::string &mention) noexcept
gets the id of a mentioned role
Definition
Core.cpp:66
Core::strip_broadcast_mentions
static std::string strip_broadcast_mentions(std::string_view text)
Definition
Core.cpp:267
src
bot_library
bot
core
include
Core.hpp
Generated by
1.18.0