2020-10-17 22:55:02 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import pprint
|
|
|
|
|
|
|
|
from sopel import module
|
|
|
|
|
2020-10-23 12:35:54 +00:00
|
|
|
from . import tlib
|
|
|
|
from . import (
|
2021-02-01 20:58:50 +00:00
|
|
|
templates_koronawirus,
|
2020-10-23 12:35:54 +00:00
|
|
|
templates_pis,
|
2021-02-01 20:58:50 +00:00
|
|
|
templates_rcb,
|
2020-10-23 12:35:54 +00:00
|
|
|
)
|
2020-10-17 22:55:02 +00:00
|
|
|
|
2020-10-23 12:21:59 +00:00
|
|
|
def _templatecmd(bot, trigger, templates):
|
2020-10-18 11:34:48 +00:00
|
|
|
if trigger.group(3) is None:
|
|
|
|
template = templates.TEMPLATE
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
if not trigger.group(3).startswith('TEMPLATE'):
|
|
|
|
raise AttributeError()
|
2020-12-11 13:25:21 +00:00
|
|
|
template = getattr(templates, trigger.group(3))
|
2020-10-18 11:34:48 +00:00
|
|
|
except AttributeError:
|
2022-04-12 13:49:23 +00:00
|
|
|
bot.reply('Nie zesraj siÄ™.')
|
2020-10-18 11:34:48 +00:00
|
|
|
return
|
2020-10-17 22:55:02 +00:00
|
|
|
|
2020-10-18 11:15:05 +00:00
|
|
|
bot.notice(tlib.render(template))
|
2020-10-23 12:21:59 +00:00
|
|
|
|
|
|
|
@module.commands('rcb', 'alertrcb')
|
|
|
|
def rcb(bot, trigger):
|
|
|
|
return _templatecmd(bot, trigger, templates_rcb)
|
2020-10-23 12:35:54 +00:00
|
|
|
|
|
|
|
@module.commands('pis')
|
|
|
|
def pis(bot, trigger):
|
|
|
|
return _templatecmd(bot, trigger, templates_pis)
|
2021-02-01 20:58:50 +00:00
|
|
|
|
|
|
|
@module.commands('koronawirus')
|
|
|
|
def koronawirus(bot, trigger):
|
|
|
|
return _templatecmd(bot, trigger, templates_koronawirus)
|