Skip to content

Instantly share code, notes, and snippets.

@s0r00t
Created August 28, 2015 18:19
Show Gist options
  • Save s0r00t/2acc06afd27776dbc14b to your computer and use it in GitHub Desktop.
Save s0r00t/2acc06afd27776dbc14b to your computer and use it in GitHub Desktop.
TicTacMachine, short version of IRCMachine for Xenthys. pip install irc on Python 2.7 before run. I tried to add commands. I failed.
import irc.bot
import time
serv = "chat.freenode.net"
chan = "#botwar"
op = "s0r00t"
class TicTacMachine(irc.bot.SingleServerIRCBot):
def __init__(self, nick, server, port=6667):
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nick, nick)
def on_nicknameinuse(self, c, e):
c.nick(c.get_nickname() + "_")
def on_welcome(self, c, e):
print("on join")
c.join(chan)
while True:
c.privmsg(chan,"tic")
time.sleep(1)
c.privmsg(chan,"tac")
time.sleep(1)
def main():
try:
TicTacMachine("TicTacMachine", serv).start()
except UnicodeDecodeError:
print("FATAL error, please restart")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment