:meta private:
(self, message, text)
| 400 | key = 'state' |
| 401 | |
| 402 | def check(self, message, text): |
| 403 | """ |
| 404 | :meta private: |
| 405 | """ |
| 406 | |
| 407 | chat_id, user_id, business_connection_id, bot_id, message_thread_id = resolve_context(message, self.bot.bot_id) |
| 408 | |
| 409 | if chat_id is None: |
| 410 | chat_id = user_id # May change in future |
| 411 | |
| 412 | if isinstance(text, list): |
| 413 | new_text = [] |
| 414 | for i in text: |
| 415 | if isinstance(i, State): i = i.name |
| 416 | new_text.append(i) |
| 417 | text = new_text |
| 418 | elif isinstance(text, State): |
| 419 | text = text.name |
| 420 | |
| 421 | user_state = self.bot.current_states.get_state( |
| 422 | chat_id=chat_id, |
| 423 | user_id=user_id, |
| 424 | business_connection_id=business_connection_id, |
| 425 | bot_id=bot_id, |
| 426 | message_thread_id=message_thread_id |
| 427 | ) |
| 428 | |
| 429 | # CHANGED BEHAVIOUR |
| 430 | if text == "*" and user_state is not None: |
| 431 | return True |
| 432 | |
| 433 | if user_state == text: |
| 434 | return True |
| 435 | elif type(text) is list and user_state in text: |
| 436 | return True |
| 437 | return False |
| 438 | |
| 439 | class IsDigitFilter(SimpleCustomFilter): |
| 440 | """ |
nothing calls this directly
no test coverage detected