data[key] = val
return data
-
+
def livelog_announcement(livelog):
# achievement gained
if 'achieve_diff' in livelog:
report_template = "{name} ({role} {race} {gender_delta} {align_delta}): " \
"{death} on {level_desc}. {points} points in {turns} turns, " \
- "wasting {realtime_pretty}. {dumplog}"
-
+ "wasting {realtime_pretty}. " \
+ "http://nethack.veekun.com/players/{name}/games/{endtime}"
CONFIG_PLAYGROUND = '/opt/nethack.veekun.com/nethack/var'
CONFIG_USERDATA_FILE = '/opt/nethack.veekun.com/dgldir/userdata'
self.xlog.seek(0, os.SEEK_END)
self.livelog.seek(0, os.SEEK_END)
- # Remove the event first, in case this is a reload
- schedule.removePeriodicEvent('nethack-log-ping')
+ # Remove the event first, in case this is a reload. This will fail if
+ # this is the first load, so throw it in a try
+ try:
+ schedule.removePeriodicEvent('nethack-log-ping')
+ except:
+ pass
def callback():
self._checkLogs(irc)
line = self.xlog.readline()
if line:
data = parse_xlog(line)
-
- # Find dumplog
- dumplog_paths = glob(
- os.path.join(CONFIG_USERDATA_FILE,
- data['name'],
- 'dumplog',
- data['starttime'])
- + '*'
- )
- if dumplog_paths:
- (_, dumplog_file) = os.path.split(dumplog_paths[0])
- dumplog_url = '{base}/{name}/dumplog/{file}'.format(
- base=CONFIG_USERDATA_WEB,
- name=data['name'],
- file=dumplog_file,
- )
- else:
- dumplog_url = "Can't find dumplog :("
-
- report = report_template.format(dumplog=dumplog_url, **data)
+ report = report_template.format(**data)
msg = ircmsgs.privmsg(CONFIG_CHANNEL, report)
irc.queueMsg(msg)