Advertisement
Aha2Y

Untitled

May 9th, 2012
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.71 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.           int eightball_number = rand()%10 + 1;
  48.           PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + ":" + eightball_number + "Blaa");
  49.          
  50.           return CONTINUE;
  51.           }
  52.     return CONTINUE;
  53.    }
  54. };
  55.  
  56. int my_random(int min, int max)
  57. {
  58.   return rand() % (max - min + 1) + min;
  59. }
  60.  
  61.  
  62. template<> void TModInfo<CInfoBot>(CModInfo& Info) {
  63.     Info.SetWikiPage("Infobot");
  64. }
  65.  
  66. USERMODULEDEFS(CInfoBot, "Infobot by Aha2Y (BETA)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement