summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/tgbot/EventBroadcaster.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/tgbot/EventBroadcaster.h b/include/tgbot/EventBroadcaster.h
index 4378c10..2bb2d2a 100644
--- a/include/tgbot/EventBroadcaster.h
+++ b/include/tgbot/EventBroadcaster.h
@@ -69,6 +69,18 @@ public:
}
/**
+ * Registers listener which receives all messages with commands (messages with leading '/' char).
+ * @param commandsList Commands names which listener can handle.
+ * @param listener Listener.
+ */
+ inline void onCommand(const std::initializer_list<std::string>& commandsList, const MessageListener& listener) {
+ for (const auto& command : commandsList)
+ {
+ _onCommandListeners[command] = listener;
+ }
+ }
+
+ /**
* Registers listener which receives all messages with commands (messages with leading '/' char) which haven't been handled by other listeners.
* @param listener Listener.
*/