Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User LP Blueprints fix and removed deprecated handler #90

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 3 additions & 25 deletions vkbottle/framework/framework/handler/user/handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import typing
import warnings
import re
from vkbottle.types.user_longpoll import Message
from vkbottle.framework.framework.rule import (
Expand Down Expand Up @@ -40,32 +39,11 @@ def dispatch(self):
self.message.rules + self.chat_message.rules + self.message_handler.rules
)

def message_new(
self, *rules: typing.Tuple[typing.Union[AbstractRule, AbstractFilter]]
):
warnings.warn(
"Event message_new is deprecated, use message, chat_message, message_handler instead. See issue #77",
DeprecationWarning,
)

def decorator(func):
rule = UserLongPollEventRule(4, *rules)
rule.create(
func,
{
"name": "message_new",
"data": ["message_id", "flags", *ADDITIONAL_FIELDS],
"dataclass": Message,
},
)
self.message_rules.append(rule)
return func

return decorator

def concatenate(self, other: "Handler"):
self.message_rules += other.message_rules
self.event.rules += other.event.rules
self.message.concatenate(other.message)
self.chat_message.concatenate(other.chat_message)
self.message_handler.concatenate(other.message_handler)


class MessageHandler:
Expand Down