39 lines
934 B
Python
39 lines
934 B
Python
#!/usr/bin/env python3
|
|
|
|
import pprint
|
|
|
|
from sopel import module
|
|
|
|
from . import tlib
|
|
from . import (
|
|
templates_koronawirus,
|
|
templates_pis,
|
|
templates_rcb,
|
|
)
|
|
|
|
def _templatecmd(bot, trigger, templates):
|
|
if trigger.group(3) is None:
|
|
template = templates.TEMPLATE
|
|
else:
|
|
try:
|
|
if not trigger.group(3).startswith('TEMPLATE'):
|
|
raise AttributeError()
|
|
template = getattr(templates, trigger.group(3))
|
|
except AttributeError:
|
|
bot.reply('Nie zesraj siÄ™.')
|
|
return
|
|
|
|
bot.notice(tlib.render(template))
|
|
|
|
@module.commands('rcb', 'alertrcb')
|
|
def rcb(bot, trigger):
|
|
return _templatecmd(bot, trigger, templates_rcb)
|
|
|
|
@module.commands('pis')
|
|
def pis(bot, trigger):
|
|
return _templatecmd(bot, trigger, templates_pis)
|
|
|
|
@module.commands('koronawirus')
|
|
def koronawirus(bot, trigger):
|
|
return _templatecmd(bot, trigger, templates_koronawirus)
|