Skip to content

Commit

Permalink
fix: for banned user check
Browse files Browse the repository at this point in the history
Merge pull request #107 from d-Rickyy-b/dev
  • Loading branch information
d-Rickyy-b committed Jul 4, 2021
2 parents 41c7c6f + 07c6a39 commit cf0d910
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 30 deletions.
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

9 changes: 9 additions & 0 deletions blackjackbot/lang/custom_strings/README.md
@@ -0,0 +1,9 @@
## custom_strings directory

This directory was created to add translations on the fly, when the bot runs inside a docker container.

```
└───lang
├───custom_strings // custom translations
└───strings // translations provided by the package maintainer
```
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1 +1 @@
python-telegram-bot==13.1
python-telegram-bot>=13.5
12 changes: 11 additions & 1 deletion util/banneduserhandler.py
@@ -1,13 +1,23 @@
# -*- coding: utf-8 -*-
import logging

from telegram.ext import TypeHandler

import database


class BannedUserHandler(TypeHandler):
logger = logging.getLogger()

def check_update(self, update):
db = database.Database()
if db.is_user_banned(update.effective_user.id):
user = update.effective_user

if user is None:
self.logger.warning(f"User is None! Update: {update}")
return False

if db.is_user_banned(user.id):
return True

return False

0 comments on commit cf0d910

Please sign in to comment.