Module: VkCozy

Defined in:
lib/vk_cozy/bot.rb,
lib/vk_cozy/user.rb,
lib/vk_cozy/polling/bot_polling.rb,
lib/vk_cozy/polling/user_polling.rb,
lib/vk_cozy/framework/labeler/bot.rb,
lib/vk_cozy/framework/labeler/user.rb,
lib/vk_cozy/types/events/bot_events.rb,
lib/vk_cozy/dispatch/views/bot/event.rb,
lib/vk_cozy/types/events/user_events.rb,
lib/vk_cozy/dispatch/views/user/event.rb,
lib/vk_cozy/framework/labeler/filters/filters.rb

Defined Under Namespace

Classes: BaseFilter, Bot, BotEvent, BotEventType, BotLabeler, BotMessageEvent, BotPolling, Text, User, UserEvent, UserEventType, UserLabeler, UserPolling, YaScan

Constant Summary collapse

MESSAGE_EXTRA_FIELDS =
[
  'peer_id', 'timestamp', 'text', 'extra_values', 'attachments', 'random_id'
]
MSGID =
'message_id'
EVENT_ATTRS_MAPPING =
{
  VkCozy::UserEventType::REPLACE_MESSAGE_FLAGS => [MSGID, 'flags'] + MESSAGE_EXTRA_FIELDS,
  VkCozy::UserEventType::INSTALL_MESSAGE_FLAGS => [MSGID, 'mask'] + MESSAGE_EXTRA_FIELDS,
  VkCozy::UserEventType::RESET_MESSAGE_FLAGS => [MSGID, 'mask'] + MESSAGE_EXTRA_FIELDS,
  VkCozy::UserEventType::MESSAGE_NEW => [MSGID, 'flags'] + MESSAGE_EXTRA_FIELDS,
  VkCozy::UserEventType::MESSAGE_EDIT => [MSGID, 'mask'] + MESSAGE_EXTRA_FIELDS,
  VkCozy::UserEventType::IN_READ => ['peer_id', 'local_id'],
  VkCozy::UserEventType::OUT_READ => ['peer_id', 'local_id'],
  VkCozy::UserEventType::FRIEND_ONLINE => ['user_id', 'extra', 'timestamp'],
  VkCozy::UserEventType::FRIEND_OFFLINE => ['user_id', 'flags', 'timestamp'],
  VkCozy::UserEventType::DIALOG_TYPING_STATE => ['user_id', 'flags']
}
PARSE_PEER_ID_EVENTS =
EVENT_ATTRS_MAPPING.map{|k, v| if v.include?('peer_id') then k end}.select{ |i| not i.nil? }
PARSE_MESSAGE_FLAGS_EVENTS =
[
  VkCozy::UserEventType::REPLACE_MESSAGE_FLAGS,
  VkCozy::UserEventType::MESSAGE_NEW
]