summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorymuv <yuramuv@gmail.com>2017-02-02 00:07:43 +0200
committerymuv <yuramuv@gmail.com>2017-02-02 00:07:43 +0200
commitc57d27df23aa59058a170701d912645d3ce60810 (patch)
treeff7339a1344950b517578662c6756b6d659e8fde /include
parentcfd0b398c3a300173339533909732b37503c34ed (diff)
Add initializer_list for register same commands.
Fix file size mistake.
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 12daef3..ebcf72a 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.
*/