better handling of debug setting
This commit is contained in:
parent
a0e3922bed
commit
b2460d8e3a
6
bot.py
6
bot.py
@ -23,7 +23,9 @@ class TelegramMonitorBot:
|
|||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.debug = os.environ.get('DEBUG') is not None
|
self.debug = (
|
||||||
|
(os.environ.get('DEBUG') is not None) &&
|
||||||
|
(os.environ.get('DEBUG').upper() != "false"))
|
||||||
|
|
||||||
# Channel to notify of violoations, e.g. '@channelname'
|
# Channel to notify of violoations, e.g. '@channelname'
|
||||||
self.notify_chat = os.environ['NOTIFY_CHAT']
|
self.notify_chat = os.environ['NOTIFY_CHAT']
|
||||||
@ -78,7 +80,7 @@ class TelegramMonitorBot:
|
|||||||
update.message.reply_text(log_message)
|
update.message.reply_text(log_message)
|
||||||
print(log_message)
|
print(log_message)
|
||||||
# Notify channel
|
# Notify channel
|
||||||
bot.sendMessage(chat_id=self.notify_chat, text=log_message)
|
bot.sendMessage(chat_id=self.notify_chat, text="🤖:" + log_message)
|
||||||
# Ban the user
|
# Ban the user
|
||||||
self.ban_user(update)
|
self.ban_user(update)
|
||||||
# Log in database
|
# Log in database
|
||||||
|
Loading…
Reference in New Issue
Block a user