Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.24 KB | None | 0 0
  1. import ch
  2. import sys
  3. import random
  4. import sqlite3
  5.  
  6. ################################################################################################################################################################################################################################################
  7. from xml.etree import cElementTree as ET
  8. if sys.version_info[0] > 2:
  9. import urllib.request as urlreq
  10. else:
  11. import urllib2 as urlreq
  12. ################################################################################################################################################################################################################################################
  13. prefix = "."
  14. ################################################################################################################################################################################################################################################
  15. class bot (ch.RoomManager):
  16. ################################################################################################################################################################################################################################################
  17. def onInit(self):
  18. self.setNameColor("FF0000")
  19. self.setFontColor("00BFFF0")
  20. self.setFontFace("Papyrus")
  21. self.setFontSize(14)
  22. self.enableBg()
  23. self.enableRecording()
  24. ################################################################################################################################################################################################################################################
  25. def onConnect(self,room):
  26. print ("[INFO] Connected to : "+room.name)
  27. self.setNameColor("FF0000")
  28. self.setFontColor("00BFFF")
  29. self.setFontFace("Papyrus")
  30. self.setFontSize(14)
  31. self.enableBg()
  32. self.enableRecording()
  33. room.message("Hello people of this Realm! I am Botler and I will serve you in any way possible. Type .cmd or .cmds If you need any of my multiple services!")
  34. ################################################################################################################################################################################################################################################
  35. def onReconnect (self,room):
  36. print ("[INFO] Reconnected to : "+room.name)
  37. self.setNameColor("FF0000")
  38. self.setFontColor("00BFFF")
  39. self.setFontFace("Papyrus")
  40. self.setFontSize(14)
  41. self.enableBg()
  42. self.enableRecord()
  43. room.message("Hello people of this Realm! I am Botler and I will serve you in any way possible. Type .cmd or .cmds If you need any of my multiple services!")
  44. ################################################################################################################################################################################################################################################
  45. def onDisconnect(self,room):
  46. print("[INFO] Discconected from : "+room.name)
  47. ################################################################################################################################################################################################################################################
  48. def onFloodWarning(self,room):
  49. print("{INFO} FloodWarning in : "+room.name)
  50. room.reconnect()
  51. ################################################################################################################################################################################################################################################
  52. def onMessage(self,room,user,message):
  53.  
  54. print(user.name+" : "+message.body)
  55.  
  56. msgdata = message.body.split(" ",1)
  57. if len(msgdata) > 1:
  58. cmd, args = msgdata[0], msgdata[1]#if command and argument
  59. else:
  60. cmd, args = msgdata[0],""#if command and no argument
  61. cmd=cmd.lower()
  62.  
  63. if len(cmd)>0:
  64. if cmd[0]==prefix:
  65. used_prefix = True
  66. cmd = cmd[1:]
  67. else:
  68. used_prefix= False
  69. else:
  70. return
  71. ################################################################################################################################################################################################################################################
  72. if used_prefix and cmd == "cmds":
  73. room.message("Available Services: Dice, Fml, Cmd, Cmds, Coin, 8Ball, Spin(B), Sleep(A), Wakeup(A), Rules")
  74. if used_prefix and cmd == "cmd":
  75. room.message("Available Services: Dice, Fml, Cmd, Cmds, Coin, 8Ball, Spin(B), Sleep(A), Wakeup(A), Rules")
  76. ################################################################################################################################################################################################################################################
  77. if used_prefix and cmd == "rules":
  78. room.message("1. No links to other ChatRooms //"+
  79. " 2. No spam //"+
  80. " 3. English only //"+
  81. " 4. Respect eachother //"+
  82. " 5. We're giving 2 Warnings //"
  83. " Enjoy @"+user.name)
  84. ################################################################################################################################################################################################################################################
  85. if used_prefix and cmd == "dice":
  86. dice=random.randint(1,100)
  87. room.message("Botler gave the dice to @"+ user.name +" and "+" rolled : "+str(dice))
  88. ################################################################################################################################################################################################################################################
  89. if used_prefix and cmd =="coin":
  90. room.message(random.choice(["I flipped a coin and it lands on heads.",
  91. "I flipped a coin and it lands on tails.",]))
  92. ################################################################################################################################################################################################################################################
  93. if used_prefix and cmd =="spin" and room.userlist:
  94. room.message("Botler spins the bottle and points at @"+(random.choice(room.usernames)))
  95. ################################################################################################################################################################################################################################################
  96. if used_prefix and cmd =="8ball":
  97. room.message(random.choice(["Ofcourse!",
  98. "Ofcourse not!",
  99. "Yes!",
  100. "No!",
  101. "Absolutely!",
  102. "Absolutely Not!",
  103. "I don't know, do you know?",
  104. "I doubt it!",
  105. "Without doubt!",
  106. "Yup!",
  107. "Nope!",
  108. "I'm sure you know that yourself!",
  109. "I won't answer that!",
  110. "Maybe"]))
  111. ################################################################################################################################################################################################################################################
  112. rooms=["beatsbydre69"]
  113. if __name__ == "__main__":
  114. bot.easy_start(rooms, "botler", "thebuttler")
  115. ################################################################################################################################################################################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement