Skip to content

Commit 7d4fc9b

Browse files
committed
Show number of clanmembers in .status
1 parent 0ee049d commit 7d4fc9b

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
+ `.servers`
66
+ `.players [server]`
77
+ `.status [server]`
8-
+ `.kill [message]`
8+
+ `.die [message]`
99
+ `.rcon [server] [command] [args...]`

config.json

+5-9
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22
"server": "irc.quakenet.org",
33
"port": 6667,
44
"prefixes": ".",
5-
"channel": "#clan6thfloor",
5+
"channel": "#channel",
66
"nick": "statusbot",
77
"owners": [
8-
"zod_"
8+
""
99
],
1010
"rconowners": [
11-
"zod_",
12-
"falco`",
13-
"nikkerz",
14-
"tampee",
15-
"tamps",
16-
"t00dark"
11+
""
1712
],
18-
"rconpasswd": ""
13+
"rconpasswd": "rcon_password",
14+
"clantag": "clan_tag"
1915
}

statusbot.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def __init__(self, config):
1414
self.owners = config["owners"]
1515
self.rconowners = config["rconowners"]
1616
self.password = config["rconpasswd"]
17+
self.clan = config["clantag"]
1718

1819
self.servers = {}
1920
for line in open("servers.txt", "r").readlines():
@@ -129,6 +130,7 @@ def parseStatus(self, data, playersCmd = False, serverCmd = False):
129130
sparts = r.split("\n")
130131

131132
players = [p for p in sparts[2:] if p]
133+
clanmems = " ".join(players).count(self.clan)
132134

133135
rawvars = sparts[1].split("\\")[1:]
134136
svars = {rawvars[i]:rawvars[i+1] for i in range(0, len(rawvars), 2)}
@@ -144,7 +146,10 @@ def parseStatus(self, data, playersCmd = False, serverCmd = False):
144146
self.reply("\x0316,2{}\x03 command sent to \x0316,2{}\x03".format(" ".join(data[1:]), name))
145147
else:
146148
gamemode = self._GAMEMODES[int(svars["g_gametype"])]
147-
self.reply("\x0316,2{}: {}/{} {} {}\x03".format(name, len(players), svars["sv_maxclients"], gamemode, svars["mapname"]))
149+
if clanmems:
150+
self.reply("\x0316,2{}: {}/{} {} {} - {} {}\x03".format(name, len(players), svars["sv_maxclients"], gamemode, svars["mapname"], clanmems, self.clan))
151+
else:
152+
self.reply("\x0316,2{}: {}/{} {} {}\x03".format(name, len(players), svars["sv_maxclients"], gamemode, svars["mapname"]))
148153

149154
def cmd_help(self, issuedBy, data):
150155
""".help [command] - displays this message"""
@@ -181,8 +186,8 @@ def cmd_status(self, issuedBy, data):
181186
for s in self.servers:
182187
self.parseStatus(s, False, False)
183188

184-
def cmd_kill(self, issuedBy, data):
185-
""".kill - kills the bot"""
189+
def cmd_die(self, issuedBy, data):
190+
""".die - kills the bot"""
186191
if issuedBy in self.owners:
187192
if data:
188193
self.die("{}".format(data))

0 commit comments

Comments
 (0)