Guest User

Untitled

a guest
Feb 18th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. import ch
  2. import random
  3. import sys
  4. import re
  5. if sys.version_info[0] > 2:
  6. import urllib.request as urlreq
  7. else:
  8. import urllib2 as urlreq
  9.  
  10. dictionary = dict()
  11.  
  12. class TestBot(ch.RoomManager):
  13. def onInit(self):
  14. self.setNameColor("09F")
  15. self.setFontColor("09F")
  16. self.setFontFace("1")
  17. self.setFontSize(13)
  18.  
  19. def onConnect(self, room):
  20. print("Connected")
  21.  
  22. def onReconnect(self, room):
  23. print("Reconnected")
  24.  
  25. def onDisconnect(self, room):
  26. print("Disconnected")
  27.  
  28. def onMessage(self, room, user, message,):
  29. if self.user == user: return
  30. if message.body[0] == "!":
  31. data = message.body[1:].split(" ", 1)
  32. if len(data) > 1:
  33. cmd, args = data[0], data[1]
  34. else:
  35. cmd, args = data[0], ""
  36. if cmd == "gtfo":
  37. room.message("( ´,_ゝ`) Okay...")
  38. self.setTimeout(int(1), room.disconnect)
  39. elif cmd == "yuno":
  40. room.message("ლ(ಠ益ಠლ) Y U NO " + args)
  41. elif cmd == "say":
  42. room.message(args)
  43. elif cmd == "flip":
  44. room.message("(╯°□°)╯︵ ┻━┻")
  45. elif cmd == "idk":
  46. room.message("¯\_(ツ)_/¯")
  47. elif cmd == "dafuq":
  48. room.message("(ಥ益ಥ)")
  49. elif cmd == "help":
  50. room.message("Commands: yuno, say, flip, idk, dafuq, define.")
  51. elif cmd == "define":
  52. if args.find(":") != -1: #if there's a colon somewhere
  53. word, definition = args.split(":", 1)
  54. if word in dictionary:
  55. room.message(word + ": already defined")
  56. else:
  57. dictionary[word] = definition
  58. room.message(word + ": " + definition)
  59. else:
  60. word = args
  61. if word in dictionary:
  62. room.message(word + ": " + dictionary[word])
  63. else:
  64. room.message(word + ": not found")
  65.  
  66.  
  67. def onFloodWarning(self, room):
  68. room.reconnect()
  69. def onUserCountChange(self, room):
  70. print("users: " + str(room.usercount))
  71. if __name__ == "__main__": TestBot.easy_start(
  72. name = "Stanbot",
  73. password = "777888***",
  74. rooms = ["satanschat"],
  75. )
Add Comment
Please, Sign In to add comment