From 802a7b99a1d090d44d897cc53b47e1dc4daaa120 Mon Sep 17 00:00:00 2001 From: hadware Date: Wed, 30 May 2018 23:48:56 +0200 Subject: [PATCH] =?UTF-8?q?TOuwjouw=20plus=20de=20fix=20et=20d'am=C3=A9lio?= =?UTF-8?q?s=20(filtrage=20par=20userid)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/constants.py | 5 ++++- tools/processors/messages.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/constants.py b/tools/constants.py index 01b8d55..eca5b00 100755 --- a/tools/constants.py +++ b/tools/constants.py @@ -1,2 +1,5 @@ DEFAULT_COOKIE = "nwoiw" -DEFAULT_CHANNEL = "zizi" \ No newline at end of file +DEFAULT_CHANNEL = "zizi" + +AUTHORIZED_USERIDS = {"9d8fc0d2131156a6", "00db53a5ceefd519", "12357ff135cb4f1f", "44bb6b27edad62b8", + "50741417ec69e746", "4e164c40c376a9bc", "d1a955757a226b1b"} \ No newline at end of file diff --git a/tools/processors/messages.py b/tools/processors/messages.py index d68badf..eacb884 100755 --- a/tools/processors/messages.py +++ b/tools/processors/messages.py @@ -1,5 +1,6 @@ from tools.coco.client import CocoClient from tools.commons import Message, BotMessage +from tools.constants import AUTHORIZED_USERIDS from .commons import * @@ -105,6 +106,9 @@ class CocoQuitCommand(BaseCocobotCommand): HELP_STR = "/cocoquit" _cmd_suffix = "quit" + def match(self, text : str, sender_id : str, users_list : UserList): + return super().match(text, sender_id, users_list) and sender_id in AUTHORIZED_USERIDS + def process(self, text : str, sender_id : str, users_list : UserList): self.cococlient.disconnect() return BotMessage("Déconnecté!")