Cppgram
1.0.0
Easy and modern C++14 Telegram Bot API wrapper
|
Handle bot commands. More...
#include <command_handler.hpp>
Public Member Functions | |
CommandHandler () | |
Empty object. | |
CommandHandler (T *bot) | |
Construct this object with empty commands. More... | |
CommandHandler (T *bot, const CommandHandler &c) | |
Construct this object. More... | |
CommandHandler (const CommandHandler &c) | |
Copy constructor. | |
CommandHandler & | operator= (const CommandHandler &c) |
Assigment constructor. More... | |
CommandHandler & | operator= (CommandHandler &&c) |
Move assigment operator. More... | |
void | addCommand (commands::Command< T > *new_command) |
Add a bot command. More... | |
void | setCommands (const CommandHandler &c) |
copy commands of another object of type CommandHandler More... | |
Private Member Functions | |
void | init (T *bot) |
Check if this object has an owner and set it to bot if not. More... | |
Handle bot commands.
Store commands and check if an update trigger a command.
CommandHandler | ( | T * | bot | ) |
Construct this object with empty commands.
bot | Pointer to the bot owner. |
CommandHandler | ( | T * | bot, |
const CommandHandler< T > & | c | ||
) |
Construct this object.
bot | Owner of this object. |
c | CommandHandler that owns the commands. |
void addCommand | ( | commands::Command< T > * | new_command | ) |
Add a bot command.
new_command | Pointer to the command to add. |
|
private |
Check if this object has an owner and set it to bot if not.
bot | Pointer to the bot owner of this object. |
CommandHandler< T > & operator= | ( | const CommandHandler< T > & | c | ) |
Assigment constructor.
A CommandHandler will be initialized with the same commands as the rvalue, but the returned object will not have any owner as two CommandHandler objects cannot share the same owner.
c | rvalue. |
CommandHandler< T > & operator= | ( | CommandHandler< T > && | c | ) |
Move assigment operator.
Assign the exact owner and all the commands to an other object using the assignation.
c | rvalue. |
void setCommands | ( | const CommandHandler< T > & | c | ) |
copy commands of another object of type CommandHandler
c | Objects that owns the command to copy. |