summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sj_tele.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/sj_tele.py')
-rw-r--r--indoteknik_custom/models/sj_tele.py10
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}'