summaryrefslogtreecommitdiff
path: root/include/bots.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/bots.h')
-rw-r--r--include/bots.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/include/bots.h b/include/bots.h
index e0f8f60dd..5a9c54a3e 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details.
*/
-#ifndef BOTS_H
-#define BOTS_H
+#pragma once
#include "users.h"
#include "anope.h"
@@ -20,16 +19,20 @@ typedef Anope::map<BotInfo *> botinfo_map;
extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
/* A service bot (NickServ, ChanServ, a BotServ bot, etc). */
-class CoreExport BotInfo : public User, public Serializable
+class CoreExport BotInfo final
+ : public User
+ , public Serializable
{
/* Channels this bot is assigned to */
Serialize::Checker<std::set<ChannelInfo *> > channels;
- public:
+public:
time_t created;
/* Last time this bot said something (via privmsg) */
time_t lastmsg;
/* Map of actual command names -> service name/permission required */
CommandInfo::map commands;
+ /* The server-side alias used to message this bot. */
+ Anope::string alias;
/* Modes the bot should have as configured in service:modes */
Anope::string botmodes;
/* Channels the bot should be in as configured in service:channels */
@@ -55,7 +58,7 @@ class CoreExport BotInfo : public User, public Serializable
virtual ~BotInfo();
void Serialize(Serialize::Data &data) const;
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
+ static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
void GenerateUID();
@@ -107,8 +110,9 @@ class CoreExport BotInfo : public User, public Serializable
/** Called when a user messages this bot
* @param u The user
* @param message The users' message
+ * @params tags Message tags
*/
- virtual void OnMessage(User *u, const Anope::string &message);
+ virtual void OnMessage(User *u, const Anope::string &message, const Anope::map<Anope::string> &tags);
/** Link a command name to a command in services
* @param cname The command name
@@ -116,7 +120,7 @@ class CoreExport BotInfo : public User, public Serializable
* @param permission Permission required to execute the command, if any
* @return The commandinfo for the newly created command
*/
- CommandInfo& SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
+ CommandInfo &SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
/** Get command info for a command
* @param cname The command name
@@ -124,12 +128,13 @@ class CoreExport BotInfo : public User, public Serializable
*/
CommandInfo *GetCommand(const Anope::string &cname);
+ /** Get the command that users can use to send a message to this bot. */
+ Anope::string GetQueryCommand() const;
+
/** Find a bot by nick
* @param nick The nick
* @param nick_only True to only look by nick, and not by UID
* @return The bot, if it exists
*/
- static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
+ static BotInfo *Find(const Anope::string &nick, bool nick_only = false);
};
-
-#endif // BOTS_H