now with ctcp version and finger support!
This commit is contained in:
parent
83754f44cb
commit
0ab6316a1d
22
commands.py
22
commands.py
|
@ -127,6 +127,12 @@ class Command:
|
|||
# else:
|
||||
# self.mesg("this ain't a valid commanderoonie, you twat")
|
||||
|
||||
def getversion(self):
|
||||
with open(self.config.self.gitdir + ".git/logs/HEAD") as f:
|
||||
for l in f:
|
||||
pass
|
||||
return l.split()[1]
|
||||
|
||||
@internal
|
||||
@cmd
|
||||
def ctcp(self, prefix, cmd, pm, line, admin, mesg):
|
||||
|
@ -138,10 +144,17 @@ class Command:
|
|||
ctcp = ctcp + "\x01"
|
||||
print(ctcp)
|
||||
self.notice(ctcp)
|
||||
elif ctcp.startswith("SOURCE"):
|
||||
ctcp = ctcp.upper()
|
||||
if ctcp.startswith("SOURCE"):
|
||||
self.notice("\x01SOURCE " + self.config.self.source + "\x01")
|
||||
elif ctcp.startswith("VERSION"):
|
||||
self.notice(f"\x01VERSION {self.getversion()}\x01")
|
||||
elif ctcp.startswith("FINGER"):
|
||||
self.notice(
|
||||
f"\x01FINGER {self.config.self.nick} version {self.getversion()} ({self.config.self.source})\x01"
|
||||
)
|
||||
elif ctcp.startswith("CLIENTINFO"):
|
||||
self.notice("\x01CLIENTINFO PING SOURCE\x01")
|
||||
self.notice("\x01CLIENTINFO PING SOURCE FINGER VERSION\x01")
|
||||
|
||||
@adm
|
||||
def quit(self, prefix, cmd, pm, line, admin, mesg):
|
||||
|
@ -187,11 +200,8 @@ class Command:
|
|||
@cmd
|
||||
def version(self, prefix, cmd, pm, line, admin, mesg):
|
||||
"""version"""
|
||||
with open(self.config.self.gitdir + ".git/logs/HEAD") as f:
|
||||
for l in f:
|
||||
pass
|
||||
mesg(
|
||||
f"{self.config.self.nick} version {l.split()[1]} ({self.config.self.source})"
|
||||
f"{self.config.self.nick} version {self.getversion()} ({self.config.self.source})"
|
||||
)
|
||||
|
||||
@cmd
|
||||
|
|
Loading…
Reference in New Issue