diff --git a/app/settings/common.py b/app/settings/common.py index 8170ceb..4fb9022 100644 --- a/app/settings/common.py +++ b/app/settings/common.py @@ -166,5 +166,6 @@ SIGNAL_MODERATORS = [] RATELIMIT_CACHE_BACKEND = "app.brake_backend.BrakeBackend" SITENAME = "Phantas.ma" +URL = "https://phantas.ma" SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') diff --git a/app/signalbot/daemon.py b/app/signalbot/daemon.py index 6d928d0..d58b90a 100644 --- a/app/signalbot/daemon.py +++ b/app/signalbot/daemon.py @@ -31,8 +31,18 @@ def main(): if group == settings.SIGNAL_MODERATORS_GROUP: if emoji == "👍" and target_author == settings.SIGNAL_ACCOUNT: if source in settings.SIGNAL_MODERATORS: - from ..item import models + from ..item import models, tasks now = timezone.now() + try: + comment = models.Comment.objects.filter(data__moderator_ts=target_ts).first() + if comment: + link = settings.URL + comment.item.get_absolute_url() + msg = '%s commented on %s at %s' % ( + comment.name, comment.item.title, link, link + ) + tasks.notify_telegram.delay(msg) + except: + pass models.Comment.objects.filter(data__moderator_ts=target_ts).update(published=now) rpc.send_reaction(target_author, target_ts, "🎉", group=group) else: diff --git a/app/telegrambot/rpc.py b/app/telegrambot/rpc.py index fa42598..773a845 100644 --- a/app/telegrambot/rpc.py +++ b/app/telegrambot/rpc.py @@ -22,7 +22,8 @@ def send(msg, to=None, channel=None, preview_url=None, preview_title=None, previ asyncio.run(bot.send_message( chat_id=channel, text=msg, - parse_mode='html' + parse_mode='html', + disable_web_page_preview=True )) except: logger.error("failed to send message to telegram: %s", msg, exc_info=True)