-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
59 lines (48 loc) · 1.68 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/python
import plaudereckenbot
import time
# IP of the TS3 server
IP = ""
# Query port of the TS3 server
PORT = 10011
# Username for the query
USERNAME = "serveradmin"
# Password for the user specified above
PASSWORD = ""
# Displayname. Name visibible to the users
DISPLAYNAME = ""
# The ID of the virtual server to run on
SID = 1
# Which channels should be treated as the original channels (Channel ids)
CHANNELLIST = [1, 2, 3]
# Channel ID of the parent channel. Created channels are children of this
CPID = 1
#########################################################################
pBot = plaudereckenbot.pBot(IP, PORT, USERNAME, PASSWORD, DISPLAYNAME,
SID, CHANNELLIST, CPID)
while 1:
emptyRooms = 0
pBot.getUserInfo()
channelUserCount = list()
print "userInfo: " + str(pBot.userInfoArray)
for i in range(len(pBot.channellist)):
channelUserCount.append(pBot.getChannelUsers(pBot.channellist[i]))
for i in range(len(channelUserCount)):
if(channelUserCount[i] > 0):
channelUserCount[i] = True
else:
emptyRooms = emptyRooms + 1
print "ChanUserCount: " + str(channelUserCount)
print "lenSetUserCount: " + str(len(set(channelUserCount)) == 1
and channelUserCount[0] == True)
if len(set(channelUserCount)) == 1 and channelUserCount[0] == True:
pBot.addChannel()
print "emptyRooms: " + str(emptyRooms)
if emptyRooms > 1:
for i in reversed(range(len(pBot.channellist))):
if channelUserCount[i] == 0:
if pBot.channellist[i] not in ORIGINALCHANNELS:
pBot.delChannel(pBot.channellist[i])
else:
break
time.sleep(5)