Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ti-bot.py
- import botlib
- # Create a new class for our bot, extending the Bot class from botlib
- class HelloWorldBot(botlib.Bot):
- def __init__(self, server, channel, nick, password=None):
- botlib.Bot.__init__(self, server, 6667, channel, nick)
- # Send nickserv password if availible
- if password != None:
- self.protocol.privmsg("nickserv", "identify" % password)
- def __actions__(self):
- botlib.Bot.__actions__(self)
- # Create a Hello World responder/command
- if botlib.check_found(self.data, "#hello"):
- # Get the senders username
- username = self.get_username()
- # Send user a message in response
- self.protocol.privmsg(self.channel, "Hello %s!" % username)
- if botlib.check_found(self.data, "$op"):
- if self.get_username() == "UbuntuGuy" or "KittyGirl" or "Ti-PrgmR":
- print "Opping : "+self.get_username()+"\n"
- nickname = self.get_username()
- self.protocol.op(self.channel, nickname)
- if botlib.check_found(self.data, "$killbot"):
- self.protocol.disconnect("UbuntuGuy's IRC Robot. Made with help from Ti-PrgmR")
- if __name__ == "__main__":
- # Create new instance of our bot and run it
- HelloWorldBot("irc.mzima.net", "#tiandubuntu", "BryceBot").run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement