Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * IRCbot "Infobot" module for ZNC.
- * Made by Aha2Y.
- */
- #include <znc/znc.h>
- #include <znc/Client.h>
- #include <znc/Chan.h>
- #include <znc/User.h>
- #include <znc/Modules.h>
- class CInfoBot : public CModule {
- public:
- MODCONSTRUCTOR(CInfoBot) {}
- virtual EModRet OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage) {
- if (sMessage == "?ping")
- {
- PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + ": Pong!");
- return CONTINUE;
- }
- else if (sMessage == "?uptime")
- {
- PutIRC("PRIVMSG " + Channel.GetName() + " :The bouncer has been up for: " + CZNC::Get().GetUptime());
- return CONTINUE;
- }
- else if (sMessage == "?version")
- {
- PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + ": InfoBot, Running on ZNC-" + CZNC::Get().GetVersion());
- return CONTINUE;
- }
- else if (sMessage.Token(0).Equals("?8ball"))
- {
- if (sMessage.Token(1).empty()) {
- PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + "Perfix: ?8ball <question>");
- return CONTINUE;
- }
- int eightball_number = rand()%10 + 1;
- PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + ":" + eightball_number + "Blaa");
- return CONTINUE;
- }
- return CONTINUE;
- }
- };
- int my_random(int min, int max)
- {
- return rand() % (max - min + 1) + min;
- }
- template<> void TModInfo<CInfoBot>(CModInfo& Info) {
- Info.SetWikiPage("Infobot");
- }
- USERMODULEDEFS(CInfoBot, "Infobot by Aha2Y (BETA)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement