Skip to content

Commit b5d7ece

Browse files
committed
fix: for banned user check
Merge pull request #107 from d-Rickyy-b/dev
2 parents 8d2034b + 29442f8 commit b5d7ece

File tree

4 files changed

+21
-30
lines changed

4 files changed

+21
-30
lines changed

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## custom_strings directory
2+
3+
This directory was created to add translations on the fly, when the bot runs inside a docker container.
4+
5+
```
6+
└───lang
7+
├───custom_strings // custom translations
8+
└───strings // translations provided by the package maintainer
9+
```

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-telegram-bot==13.1
1+
python-telegram-bot>=13.5

util/banneduserhandler.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
# -*- coding: utf-8 -*-
2+
import logging
3+
24
from telegram.ext import TypeHandler
35

46
import database
57

68

79
class BannedUserHandler(TypeHandler):
10+
logger = logging.getLogger()
811

912
def check_update(self, update):
1013
db = database.Database()
11-
if db.is_user_banned(update.effective_user.id):
14+
user = update.effective_user
15+
16+
if user is None:
17+
self.logger.warning(f"User is None! Update: {update}")
18+
return False
19+
20+
if db.is_user_banned(user.id):
1221
return True
22+
1323
return False

0 commit comments

Comments
 (0)