-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
175 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
from .functions import notify_admins | ||
from .commands import answer_comment_cmd, reload_languages_cmd, users_cmd, kill_game_cmd | ||
from .commands import answer_comment_cmd, reload_languages_cmd, users_cmd, kill_game_cmd, ban_user_cmd, \ | ||
unban_user_cmd, bans_cmd | ||
|
||
__all__ = ["answer_comment_cmd", "reload_languages_cmd", "users_cmd", "notify_admins", "kill_game_cmd"] | ||
__all__ = ["answer_comment_cmd", "reload_languages_cmd", "users_cmd", "notify_admins", "kill_game_cmd", "ban_user_cmd", | ||
"unban_user_cmd", "bans_cmd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
from .bannedusercallback import banned_user_callback | ||
from .banneduserhandler import BannedUserHandler | ||
from .cache import Cache | ||
|
||
__all__ = ['Cache'] | ||
__all__ = ["Cache", "BannedUserHandler", "banned_user_callback"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
def banned_user_callback(update, context): | ||
"""Gets called by the dispatcher when it's found that the user sending the update was banned from using the bot""" | ||
banned_text = "You have been banned from using this bot!" | ||
|
||
if update.callback_query: | ||
update.callback_query.answer(banned_text) | ||
else: | ||
update.effective_message.reply_text(banned_text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
from telegram.ext import TypeHandler | ||
|
||
import database | ||
|
||
|
||
class BannedUserHandler(TypeHandler): | ||
|
||
def check_update(self, update): | ||
db = database.Database() | ||
if db.is_user_banned(update.effective_user.id): | ||
return True | ||
return False |