Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ch
- import random
- import sys
- import re
- if sys.version_info[0] > 2:
- import urllib.request as urlreq
- else:
- import urllib2 as urlreq
- dictionary = dict()
- class TestBot(ch.RoomManager):
- def onInit(self):
- self.setNameColor("09F")
- self.setFontColor("09F")
- self.setFontFace("1")
- self.setFontSize(13)
- def onConnect(self, room):
- print("Connected")
- def onReconnect(self, room):
- print("Reconnected")
- def onDisconnect(self, room):
- print("Disconnected")
- def onMessage(self, room, user, message,):
- if self.user == user: return
- if message.body[0] == "!":
- data = message.body[1:].split(" ", 1)
- if len(data) > 1:
- cmd, args = data[0], data[1]
- else:
- cmd, args = data[0], ""
- if cmd == "gtfo":
- room.message("( ´,_ゝ`) Okay...")
- self.setTimeout(int(1), room.disconnect)
- elif cmd == "yuno":
- room.message("ლ(ಠ益ಠლ) Y U NO " + args)
- elif cmd == "say":
- room.message(args)
- elif cmd == "flip":
- room.message("(╯°□°)╯︵ ┻━┻")
- elif cmd == "idk":
- room.message("¯\_(ツ)_/¯")
- elif cmd == "dafuq":
- room.message("(ಥ益ಥ)")
- elif cmd == "help":
- room.message("Commands: yuno, say, flip, idk, dafuq, define.")
- elif cmd == "define":
- if args.find(":") != -1: #if there's a colon somewhere
- word, definition = args.split(":", 1)
- if word in dictionary:
- room.message(word + ": already defined")
- else:
- dictionary[word] = definition
- room.message(word + ": " + definition)
- else:
- word = args
- if word in dictionary:
- room.message(word + ": " + dictionary[word])
- else:
- room.message(word + ": not found")
- def onFloodWarning(self, room):
- room.reconnect()
- def onUserCountChange(self, room):
- print("users: " + str(room.usercount))
- if __name__ == "__main__": TestBot.easy_start(
- name = "Stanbot",
- password = "777888***",
- rooms = ["satanschat"],
- )
Add Comment
Please, Sign In to add comment