Advertisement
Aha2Y

Untitled

May 9th, 2012
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.61 KB | None | 0 0
  1. /*
  2.  * IRCbot "Infobot" module for ZNC.
  3.  * Made by Aha2Y.
  4. */
  5.  
  6. #include <znc/znc.h>
  7. #include <znc/Client.h>
  8. #include <znc/Chan.h>
  9. #include <znc/User.h>
  10. #include <znc/Modules.h>
  11.  
  12. class CInfoBot : public CModule {
  13. public:
  14.     MODCONSTRUCTOR(CInfoBot) {}
  15.    
  16.     virtual EModRet OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage) {
  17.    
  18.         if (sMessage == "?ping")
  19.       {
  20.           PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + ": Pong!");
  21.      
  22.           return CONTINUE;
  23.         }
  24.      
  25.       else if (sMessage == "?uptime")
  26.       {
  27.           PutIRC("PRIVMSG " + Channel.GetName() + " :The bouncer has been up for: " + CZNC::Get().GetUptime());
  28.          
  29.           return CONTINUE;
  30.       }
  31.      
  32.       else if (sMessage == "?version")
  33.       {
  34.           PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + ": InfoBot, Running on ZNC-" + CZNC::Get().GetVersion());
  35.          
  36.           return CONTINUE;
  37.          
  38.       }
  39.      
  40.       else if (sMessage.Token(0).Equals("?8ball"))
  41.       {
  42.           if (sMessage.Token(1).empty()) {
  43.               PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + ": Perfix: ?8ball <question>");
  44.            
  45.               return CONTINUE;
  46.           }
  47.           eightball_number = rand()%10;
  48.           PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + ":" + eightball_number);
  49.          
  50.           return CONTINUE;
  51.       }
  52.     return CONTINUE;
  53.    }
  54. };
  55.  
  56.  
  57. template<> void TModInfo<CInfoBot>(CModInfo& Info) {
  58.     Info.SetWikiPage("Infobot");
  59. }
  60.  
  61. USERMODULEDEFS(CInfoBot, "Infobot by Aha2Y (BETA)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement