conf() added; source command added

This commit is contained in:
urlbot
2014-09-14 12:26:39 +02:00
parent 3b1783011f
commit c5a73aaf62
3 changed files with 18 additions and 1 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.*swp .*swp
*.pyc
cmdfifo cmdfifo
logs/ logs/
event_files/ event_files/

View File

@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys, os, re, time, urllib, pickle, random, HTMLParser import sys, os, re, time, urllib, pickle, random, HTMLParser
from local_config import conf
BUFSIZ = 8192 BUFSIZ = 8192
delay = 0.100 # seconds delay = 0.100 # seconds
@@ -211,13 +212,15 @@ def parse_commands(data):
return False return False
if 'command' in data: if 'command' in data:
chat_write(reply_user + (""": known commands: 'command', 'info', 'hangup', 'ping', 'uptime', 'version'""")) chat_write(reply_user + (""": known commands: 'command', 'info', 'hangup', 'ping', 'uptime', 'source', 'version'"""))
elif 'version' in data: elif 'version' in data:
chat_write(reply_user + (''': I'm running ''' + VERSION)) chat_write(reply_user + (''': I'm running ''' + VERSION))
elif 'unikot' in data: elif 'unikot' in data:
chat_write(reply_user + (u''': ┌────────┐''')) chat_write(reply_user + (u''': ┌────────┐'''))
chat_write(reply_user + (u''': │Unicode!│''')) chat_write(reply_user + (u''': │Unicode!│'''))
chat_write(reply_user + (u''': └────────┘''')) chat_write(reply_user + (u''': └────────┘'''))
elif 'source' in data:
chat_write('My source code can be found at %s' % conf('src-url'))
elif 'uptime' in data: elif 'uptime' in data:
u = int(uptime + time.time()) u = int(uptime + time.time())
plural_uptime = 's' plural_uptime = 's'

13
local_config.py.skel Normal file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/python
if '__main__' == __name__:
print '''this is a config file, which is not meant to be executed'''
exit(-1)
config = {}
config['src-url'] = 'FIXME'
def conf(val):
if val in config.keys():
return config[val]
return None