Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #ti-bot.py
  2. import botlib
  3.  
  4. # Create a new class for our bot, extending the Bot class from botlib
  5. class HelloWorldBot(botlib.Bot):
  6. def __init__(self, server, channel, nick, password=None):
  7. botlib.Bot.__init__(self, server, 6667, channel, nick)
  8. # Send nickserv password if availible
  9. if password != None:
  10. self.protocol.privmsg("nickserv", "identify" % password)
  11.  
  12. def __actions__(self):
  13. botlib.Bot.__actions__(self)
  14.  
  15. # Create a Hello World responder/command
  16. if botlib.check_found(self.data, "#hello"):
  17. # Get the senders username
  18. username = self.get_username()
  19.  
  20. # Send user a message in response
  21. self.protocol.privmsg(self.channel, "Hello %s!" % username)
  22. if botlib.check_found(self.data, "$op"):
  23. if self.get_username() == "UbuntuGuy" or "KittyGirl" or "Ti-PrgmR":
  24. print "Opping : "+self.get_username()+"\n"
  25. nickname = self.get_username()
  26. self.protocol.op(self.channel, nickname)
  27. if botlib.check_found(self.data, "$killbot"):
  28. self.protocol.disconnect("UbuntuGuy's IRC Robot. Made with help from Ti-PrgmR")
  29.  
  30. if __name__ == "__main__":
  31. # Create new instance of our bot and run it
  32. HelloWorldBot("irc.mzima.net", "#tiandubuntu", "BryceBot").run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement