Make ethercalc support optional
Do not require ethercalc URL and cells.
This commit is contained in:
parent
b8ca0c43ff
commit
b9790b685f
|
@ -46,7 +46,11 @@ Edit config.ini contents, for example::
|
||||||
server=irc.freenode.net
|
server=irc.freenode.net
|
||||||
port=6667
|
port=6667
|
||||||
channels=testptg
|
channels=testptg
|
||||||
db=html/ptg.json
|
|
||||||
|
[db]
|
||||||
|
filename=html/ptg.json
|
||||||
|
ethercalc=
|
||||||
|
cells=
|
||||||
|
|
||||||
In one terminal, run the bot::
|
In one terminal, run the bot::
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,12 @@ class PTGDataBase():
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def from_ethercalc(self):
|
def from_ethercalc(self):
|
||||||
|
if self.ethercalc_url:
|
||||||
ethercalc = requests.get(self.ethercalc_url).json()
|
ethercalc = requests.get(self.ethercalc_url).json()
|
||||||
self.data['ethercalc'] = []
|
self.data['ethercalc'] = []
|
||||||
for cell in self.ethercalc_cells:
|
for cell in self.ethercalc_cells:
|
||||||
if 'comment' in ethercalc[cell] and 'datavalue' in ethercalc[cell]:
|
if ('comment' in ethercalc[cell] and
|
||||||
|
'datavalue' in ethercalc[cell]):
|
||||||
msg = '%s: %s' % (ethercalc[cell]['comment'],
|
msg = '%s: %s' % (ethercalc[cell]['comment'],
|
||||||
ethercalc[cell]['datavalue'])
|
ethercalc[cell]['datavalue'])
|
||||||
self.data['ethercalc'].append(msg)
|
self.data['ethercalc'].append(msg)
|
||||||
|
|
Loading…
Reference in New Issue