@@ -64,7 +64,7 @@ def __init__(self, instance_id: str = None):
64
64
formatter = logging .Formatter ('%(asctime)s %(levelname)s %(message)s' )
65
65
hdlr .setFormatter (formatter )
66
66
self .logger .addHandler (hdlr )
67
- self .logger .setLevel (logging .DEBUG )
67
+ self .logger .setLevel (logging .ERROR )
68
68
69
69
def process_message (self , message : EFBMsg ) -> Optional [EFBMsg ]:
70
70
config = yaml .load (open (utils .get_config_path (self .middleware_id ), encoding = "UTF-8" ))
@@ -85,22 +85,24 @@ def process_message(self, message: EFBMsg) -> Optional[EFBMsg]:
85
85
def black_match (self , from_ , from_alias , configs ):
86
86
if self .match_mode == "fuzz" :
87
87
for config in configs :
88
- if from_ in config or from_alias in config :
88
+ if config in from_ or config in from_alias :
89
89
return False
90
90
return True
91
- else :
91
+
92
+ else :
92
93
if from_ in configs or from_alias in configs :
93
94
return False
94
95
else :
95
96
return True
97
+
96
98
97
99
def white_match (self , from_ , from_alias , configs ):
98
- if self .match_mode == "fuzz" :
100
+ if self .match_mode == "fuzz" :
99
101
for config in configs :
100
- if from_ in config or from_alias in config :
102
+ if config in from_ or config in from_alias :
101
103
return True
102
104
return False
103
- else :
105
+ else :
104
106
if from_ in configs or from_alias in configs :
105
107
return True
106
108
else :
@@ -113,7 +115,7 @@ def is_keep_message(self, work_mode: WorkMode, message: EFBMsg, configs: list) -
113
115
# self.logger.debug("Received message from person: %s--%s", from_person, from_alias)
114
116
self .logger .debug ("Received message from myself: %s" , message .author .is_self )
115
117
self .logger .debug ("Received message from chat: %s--%s" , message .chat .chat_alias , message .chat .chat_name )
116
-
118
+ self . logger . debug ( "Rktke: %s" , self . match_mode )
117
119
if message .chat .chat_type .value == "Group" :
118
120
self .logger .debug ("Received message from group: %s--%s" , message .author .group .chat_alias , message .author .group .chat_name )
119
121
from_ = message .author .group .chat_name
@@ -131,11 +133,13 @@ def is_keep_message(self, work_mode: WorkMode, message: EFBMsg, configs: list) -
131
133
from_alias = from_
132
134
if message .chat .vendor_specific is not None and message .chat .vendor_specific ['is_mp' ]:
133
135
if work_mode is WorkMode .black_public :
136
+ self .logger .debug ("Receive work black public" )
134
137
return self .black_match (from_ , from_alias , configs )
135
138
if work_mode is WorkMode .white_public :
136
139
return self .white_match (from_ , from_alias , configs )
137
140
else :
138
141
if work_mode is WorkMode .black_person :
142
+ self .logger .debug ("Receive work black person" )
139
143
return self .black_match (from_ , from_alias , configs )
140
144
if work_mode is WorkMode .white_person :
141
145
return self .white_match (from_ , from_alias , configs )
0 commit comments