diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-11-17 17:10:38 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-11-17 17:10:38 +0700 |
| commit | 0e026757427842dc865a5cbf17f2e3d85a30875c (patch) | |
| tree | 894d70952882feb9d481262eec05941208fbde00 /indoteknik_custom/models/sj_tele.py | |
| parent | 41c678e8483109bfd89f98f6e0be7d6325f7546f (diff) | |
<Miqdad> prevent schedule action
Diffstat (limited to 'indoteknik_custom/models/sj_tele.py')
| -rw-r--r-- | indoteknik_custom/models/sj_tele.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sj_tele.py b/indoteknik_custom/models/sj_tele.py index 53ba26fc..ed363f59 100644 --- a/indoteknik_custom/models/sj_tele.py +++ b/indoteknik_custom/models/sj_tele.py @@ -5,6 +5,7 @@ import json import logging, subprocess import time from collections import OrderedDict +import socket _logger = logging.getLogger(__name__) @@ -20,7 +21,16 @@ class SjTele(models.Model): date_doc_kirim = fields.Datetime(string='Tanggal Kirim SJ') is_sent = fields.Boolean(default=False) + @staticmethod + def is_local_env(): + hostname = socket.gethostname().lower() + keywords = ['andri', 'miqdad', 'fin', 'stephan', 'hafid', 'nathan'] + return any(keyword in hostname for keyword in keywords) + def woi(self): + if self.is_local_env(): + _logger.warning("📪 Local environment detected — skip sending email reminders.") + return bot_mqdd = '8203414501:AAHy_XwiUAVrgRM2EJzW7sZx9npRLITZpb8' chat_id_mqdd = '-1003087280519' api_base = f'https://api.telegram.org/bot{bot_mqdd}' |
