run.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/python
  2. import plaudereckenbot
  3. import time
  4. IP = ""
  5. PORT = 10011
  6. USERNAME = "serveradmin"
  7. PASSWORD = ""
  8. SID = 1
  9. ORIGINALCHANNELS = []
  10. CHANNELLIST = [] # == ORIGINALCHANNELS
  11. CPID = 54
  12. pBot = plaudereckenbot.pBot(IP, PORT, USERNAME, PASSWORD,
  13. SID, CHANNELLIST, CPID)
  14. while 1:
  15. emptyRooms = 0
  16. pBot.getUserInfo()
  17. channelUserCount = list()
  18. print "userInfo: " + str(pBot.userInfoArray)
  19. for i in range(len(pBot.channellist)):
  20. channelUserCount.append(pBot.getChannelUsers(pBot.channellist[i]))
  21. for i in range(len(channelUserCount)):
  22. if(channelUserCount[i] > 0):
  23. channelUserCount[i] = True
  24. else:
  25. emptyRooms = emptyRooms + 1
  26. print "ChanUserCount: " + str(channelUserCount)
  27. print "lenSetUserCount: " + str(len(set(channelUserCount)) == 1
  28. and channelUserCount[0] == True)
  29. if len(set(channelUserCount)) == 1 and channelUserCount[0] == True:
  30. pBot.addChannel()
  31. print "emptyRooms: " + str(emptyRooms)
  32. if emptyRooms > 1:
  33. for i in reversed(range(len(pBot.channellist))):
  34. if channelUserCount[i] == 0:
  35. if pBot.channellist[i] not in ORIGINALCHANNELS:
  36. pBot.delChannel(pBot.channellist[i])
  37. break
  38. time.sleep(5)