Add barebones to better tgbot

Also send tg spam from ohlhafv challenges!
This commit is contained in:
okalintu
2019-02-08 18:26:06 +02:00
parent 0f0389b8ff
commit 8a8751ce66
4 changed files with 83 additions and 11 deletions
+8
View File
@@ -0,0 +1,8 @@
Uusi Ohlhafv haaste!
====================
Haastaja: {{ challenge.challenger }}
Uhri: {{ challenge.victim }}
Sarja: {{ challenge.get_series_display }}
Terveiset: {{ challenge.message }}
Käy kurkkaamassa muutkin haasteet osoitteessa: {{ url }}
+8
View File
@@ -19,6 +19,7 @@ from ohlhafv.models import OhlhafvChallenge
from ohlhafv.forms import OhlhafvForm
from ohlhafv.tables import OhlhafvTable
from webapp.utils import send_email
from kaehmy.tgbot import TelegramBot
@require_http_methods(["GET"])
@@ -48,6 +49,13 @@ def ohlhafv_submit(request, *args, **kwargs):
}
)
send_email(email, subject, message)
tg_message = render_to_string(
'ohlhafv:tgmsg.tpl', {
'challenge': challenge,
'url': url})
bot = TelegramBot()
bot.broadcast(tg_message)
logging.debug(
'Sent ohlhafv email to recipient <{}>'.format(email))
else: