Class: Vk::API::Messages

Inherits:
Schema::Namespace show all
Defined in:
lib/vk/api/methods.rb,
lib/vk/api/objects.rb,
lib/vk/api/responses.rb,
lib/vk/api/messages/chat.rb,
lib/vk/api/messages/dialog.rb,
lib/vk/api/messages/message.rb,
lib/vk/api/messages/chat_full.rb,
lib/vk/api/messages/methods/get.rb,
lib/vk/api/messages/message_link.rb,
lib/vk/api/messages/methods/send.rb,
lib/vk/api/messages/last_activity.rb,
lib/vk/api/messages/methods/delete.rb,
lib/vk/api/messages/methods/search.rb,
lib/vk/api/messages/longpoll_params.rb,
lib/vk/api/messages/methods/restore.rb,
lib/vk/api/messages/methods/get_chat.rb,
lib/vk/api/messages/methods/edit_chat.rb,
lib/vk/api/messages/methods/get_by_id.rb,
lib/vk/api/messages/chat_push_settings.rb,
lib/vk/api/messages/message_attachment.rb,
lib/vk/api/messages/attachments_history.rb,
lib/vk/api/messages/methods/create_chat.rb,
lib/vk/api/messages/methods/get_dialogs.rb,
lib/vk/api/messages/methods/get_history.rb,
lib/vk/api/messages/user_xtr_invited_by.rb,
lib/vk/api/messages/methods/mark_as_read.rb,
lib/vk/api/messages/methods/set_activity.rb,
lib/vk/api/messages/methods/add_chat_user.rb,
lib/vk/api/messages/methods/delete_dialog.rb,
lib/vk/api/messages/methods/get_chat_users.rb,
lib/vk/api/messages/methods/search_dialogs.rb,
lib/vk/api/messages/methods/set_chat_photo.rb,
lib/vk/api/messages/responses/get_response.rb,
lib/vk/api/messages/responses/send_response.rb,
lib/vk/api/messages/methods/remove_chat_user.rb,
lib/vk/api/messages/methods/delete_chat_photo.rb,
lib/vk/api/messages/methods/get_last_activity.rb,
lib/vk/api/messages/methods/mark_as_important.rb,
lib/vk/api/messages/responses/delete_response.rb,
lib/vk/api/messages/responses/search_response.rb,
lib/vk/api/messages/responses/restore_response.rb,
lib/vk/api/messages/responses/get_chat_response.rb,
lib/vk/api/messages/methods/get_long_poll_server.rb,
lib/vk/api/messages/responses/edit_chat_response.rb,
lib/vk/api/messages/responses/get_by_id_response.rb,
lib/vk/api/messages/methods/get_long_poll_history.rb,
lib/vk/api/messages/responses/create_chat_response.rb,
lib/vk/api/messages/responses/get_dialogs_response.rb,
lib/vk/api/messages/responses/get_history_response.rb,
lib/vk/api/messages/methods/get_history_attachments.rb,
lib/vk/api/messages/responses/mark_as_read_response.rb,
lib/vk/api/messages/responses/set_activity_response.rb,
lib/vk/api/messages/responses/add_chat_user_response.rb,
lib/vk/api/messages/responses/delete_dialog_response.rb,
lib/vk/api/messages/responses/get_chat_users_response.rb,
lib/vk/api/messages/responses/search_dialogs_response.rb,
lib/vk/api/messages/responses/set_chat_photo_response.rb,
lib/vk/api/messages/responses/remove_chat_user_response.rb,
lib/vk/api/messages/responses/delete_chat_photo_response.rb,
lib/vk/api/messages/responses/get_last_activity_response.rb,
lib/vk/api/messages/responses/mark_as_important_response.rb,
lib/vk/api/messages/responses/get_long_poll_server_response.rb,
lib/vk/api/messages/responses/get_long_poll_history_response.rb,
lib/vk/api/messages/responses/get_history_attachments_response.rb

Defined Under Namespace

Modules: Methods, Responses Classes: AttachmentsHistory, Chat, ChatFull, ChatPushSettings, Dialog, LastActivity, LongpollParams, Message, MessageAttachment, MessageLink, UserXtrInvitedBy

Instance Attribute Summary

Attributes inherited from Schema::Namespace

#client

DSL collapse

Methods inherited from Schema::Namespace

#call, #initialize

Constructor Details

This class inherits a constructor from Vk::Schema::Namespace

Instance Method Details

#add_chat_user(arguments = {}) ⇒ Vk::API::Messages::Responses::AddChatUserResponse

Returns Adds a new user to a chat.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :chat_id (Integer)

    Chat ID.

  • :user_id (Integer)

    ID of the user to be added to the chat.

Returns:

See Also:



4387
4388
4389
4390
4391
4392
4393
# File 'lib/vk/api/methods.rb', line 4387

def add_chat_user(arguments = {})
  require "vk/api/messages/methods/add_chat_user"
  method = Methods::AddChatUser.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/add_chat_user_response"
  Responses::AddChatUserResponse.new(response.deep_symbolize_keys)
end

#create_chat(arguments = {}) ⇒ Vk::API::Messages::Responses::CreateChatResponse

Returns Creates a chat with several participants.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :user_ids (Array)

    IDs of the users to be added to the chat.

  • :title (String)

    Chat title.

Returns:

See Also:



4323
4324
4325
4326
4327
4328
4329
# File 'lib/vk/api/methods.rb', line 4323

def create_chat(arguments = {})
  require "vk/api/messages/methods/create_chat"
  method = Methods::CreateChat.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/create_chat_response"
  Responses::CreateChatResponse.new(response.deep_symbolize_keys)
end

#delete(arguments = {}) ⇒ Vk::API::Messages::Responses::DeleteResponse

Returns Deletes one or more messages.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :message_ids (Array)

    Message IDs.

  • :spam (Boolean)

    '1' — to mark message as spam.

Returns:

See Also:



4217
4218
4219
4220
4221
4222
4223
# File 'lib/vk/api/methods.rb', line 4217

def delete(arguments = {})
  require "vk/api/messages/methods/delete"
  method = Methods::Delete.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/delete_response"
  Responses::DeleteResponse.new(response.deep_symbolize_keys)
end

#delete_chat_photo(arguments = {}) ⇒ Vk::API::Messages::Responses::DeleteChatPhotoResponse

Returns Deletes a chat's cover picture.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :chat_id (Integer)

    Chat ID.

Returns:

See Also:



4432
4433
4434
4435
4436
4437
4438
# File 'lib/vk/api/methods.rb', line 4432

def delete_chat_photo(arguments = {})
  require "vk/api/messages/methods/delete_chat_photo"
  method = Methods::DeleteChatPhoto.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/delete_chat_photo_response"
  Responses::DeleteChatPhotoResponse.new(response.deep_symbolize_keys)
end

#delete_dialog(arguments = {}) ⇒ Vk::API::Messages::Responses::DeleteDialogResponse

Returns Deletes all private messages in a conversation.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :user_id (String)

    User ID. To clear a chat history use 'chat_id'

  • :peer_id (Integer)

    Destination ID.; ; "For user:; 'User ID', e.g. '12345'.; ; For chat:; '2000000000' + 'chat_id', e.g. '2000000001'.; ; For community:; '- community ID', e.g. '-12345'.; "

  • :offset (Integer)

    Offset needed to return a specific subset of messages.

  • :count (Integer)

    Number of messages to delete.; "NOTE: If the number of messages exceeds the maximum, the method shall be called several times."

Returns:

See Also:



4231
4232
4233
4234
4235
4236
4237
# File 'lib/vk/api/methods.rb', line 4231

def delete_dialog(arguments = {})
  require "vk/api/messages/methods/delete_dialog"
  method = Methods::DeleteDialog.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/delete_dialog_response"
  Responses::DeleteDialogResponse.new(response.deep_symbolize_keys)
end

#edit_chat(arguments = {}) ⇒ Vk::API::Messages::Responses::EditChatResponse

Returns Edits the title of a chat.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :chat_id (Integer)

    Chat ID.

  • :title (String)

    New title of the chat.

Returns:

See Also:



4335
4336
4337
4338
4339
4340
4341
# File 'lib/vk/api/methods.rb', line 4335

def edit_chat(arguments = {})
  require "vk/api/messages/methods/edit_chat"
  method = Methods::EditChat.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/edit_chat_response"
  Responses::EditChatResponse.new(response.deep_symbolize_keys)
end

#get(arguments = {}) ⇒ Vk::API::Messages::Responses::GetResponse

Returns a list of the current user's incoming or outgoing private messages.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :out (Boolean)

    '1' — to return outgoing messages; '0' — to return incoming messages (default)

  • :offset (Integer)

    Offset needed to return a specific subset of messages.

  • :count (Integer) — default: 20

    Number of messages to return.

  • :time_offset (Integer)

    Maximum time since a message was sent, in seconds. To return messages without a time limitation, set as '0'.

  • :preview_length (Integer)

    Number of characters after which to truncate a previewed message. To preview the full message, specify '0'.; "NOTE: Messages are not truncated by default. Messages are truncated by words."

  • :last_message_id (Integer)

    ID of the message received before the message that will be returned last (provided that no more than 'count' messages were received before it; otherwise 'offset' parameter shall be used).

Returns:

See Also:



4110
4111
4112
4113
4114
4115
4116
# File 'lib/vk/api/methods.rb', line 4110

def get(arguments = {})
  require "vk/api/messages/methods/get"
  method = Methods::Get.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_response"
  Responses::GetResponse.new(response.deep_symbolize_keys)
end

#get_by_id(arguments = {}) ⇒ Vk::API::Messages::Responses::GetByIdResponse

Returns messages by their IDs.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :message_ids (Array)

    Message IDs.

Returns:

See Also:



4136
4137
4138
4139
4140
4141
4142
# File 'lib/vk/api/methods.rb', line 4136

def get_by_id(arguments = {})
  require "vk/api/messages/methods/get_by_id"
  method = Methods::GetById.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_by_id_response"
  Responses::GetByIdResponse.new(response.deep_symbolize_keys)
end

#get_chat(arguments = {}) ⇒ Vk::API::Messages::Responses::GetChatResponse

Returns information about a chat.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :chat_id (Integer)

    Chat ID.

  • :chat_ids (Array)

    Chat IDs.

  • :fields (Array)

    Profile fields to return.;

  • :name_case (String)

    Case for declension of user name and surname:; 'nom' — nominative (default); 'gen' — genitive ; 'dat' — dative; 'acc' — accusative ; 'ins' — instrumental ; 'abl' — prepositional

Returns:

See Also:



4311
4312
4313
4314
4315
4316
4317
# File 'lib/vk/api/methods.rb', line 4311

def get_chat(arguments = {})
  require "vk/api/messages/methods/get_chat"
  method = Methods::GetChat.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_chat_response"
  Responses::GetChatResponse.new(response.deep_symbolize_keys)
end

#get_chat_users(arguments = {}) ⇒ Vk::API::Messages::Responses::GetChatUsersResponse

Returns a list of IDs of users participating in a chat.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :chat_id (Integer)

    Chat ID.

  • :chat_ids (Array)

    Chat IDs.

  • :fields (Array)

    Profile fields to return.;

  • :name_case (String)

    Case for declension of user name and surname:; 'nom' — nominative (default); 'gen' — genitive; 'dat' — dative; 'acc' — accusative; 'ins' — instrumental; 'abl' — prepositional

Returns:

See Also:



4349
4350
4351
4352
4353
4354
4355
# File 'lib/vk/api/methods.rb', line 4349

def get_chat_users(arguments = {})
  require "vk/api/messages/methods/get_chat_users"
  method = Methods::GetChatUsers.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_chat_users_response"
  Responses::GetChatUsersResponse.new(response.deep_symbolize_keys)
end

#get_dialogs(arguments = {}) ⇒ Vk::API::Messages::Responses::GetDialogsResponse

Returns a list of the current user's conversations.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :offset (Integer)

    Offset needed to return a specific subset of messages.

  • :count (Integer) — default: 20

    Number of messages to return.

  • :start_message_id (Integer)

    ID of the message from what to return dialogs.

  • :preview_length (Integer)

    Number of characters after which to truncate a previewed message. To preview the full message, specify '0'.; "NOTE: Messages are not truncated by default. Messages are truncated by words."

  • :unread (Boolean)

    '1' — return unread messages only.

Returns:

See Also:



4125
4126
4127
4128
4129
4130
4131
# File 'lib/vk/api/methods.rb', line 4125

def get_dialogs(arguments = {})
  require "vk/api/messages/methods/get_dialogs"
  method = Methods::GetDialogs.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_dialogs_response"
  Responses::GetDialogsResponse.new(response.deep_symbolize_keys)
end

#get_history(arguments = {}) ⇒ Vk::API::Messages::Responses::GetHistoryResponse

Returns message history for the specified user or group chat.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :offset (Integer)

    Offset needed to return a specific subset of messages.

  • :count (Integer) — default: 20

    Number of messages to return.

  • :user_id (String)

    ID of the user whose message history you want to return.

  • :peer_id (Integer)
  • :start_message_id (Integer)

    Starting message ID from which to return history.

  • :rev (Integer)

    Sort order:; '1' — return messages in chronological order.; '0' — return messages in reverse chronological order.

Returns:

See Also:



4166
4167
4168
4169
4170
4171
4172
# File 'lib/vk/api/methods.rb', line 4166

def get_history(arguments = {})
  require "vk/api/messages/methods/get_history"
  method = Methods::GetHistory.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_history_response"
  Responses::GetHistoryResponse.new(response.deep_symbolize_keys)
end

#get_history_attachments(arguments = {}) ⇒ Vk::API::Messages::Responses::GetHistoryAttachmentsResponse

Returns media files from the dialog or group chat.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :peer_id (Integer)

    Peer ID.; ; "; For group chat:; '2000000000 + chat ID' ; ; For community:; '-community ID'"

  • :media_type (String) — default: "photo"

    Type of media files to return:; *'photo';; *'video';; *'audio';; *'doc';; *'link'.;

  • :start_from (String)

    Message ID to start return results from.

  • :count (Integer) — default: 30

    Number of objects to return.

  • :photo_sizes (Boolean)

    '1' — to return photo sizes in a

  • :fields (Array)

    Additional to return.

Returns:

See Also:



4182
4183
4184
4185
4186
4187
4188
# File 'lib/vk/api/methods.rb', line 4182

def get_history_attachments(arguments = {})
  require "vk/api/messages/methods/get_history_attachments"
  method = Methods::GetHistoryAttachments.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_history_attachments_response"
  Responses::GetHistoryAttachmentsResponse.new(response.deep_symbolize_keys)
end

#get_last_activity(arguments = {}) ⇒ Vk::API::Messages::Responses::GetLastActivityResponse

Returns a user's current status and date of last activity.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :user_id (Integer)

    User ID.

Returns:

See Also:



4410
4411
4412
4413
4414
4415
4416
# File 'lib/vk/api/methods.rb', line 4410

def get_last_activity(arguments = {})
  require "vk/api/messages/methods/get_last_activity"
  method = Methods::GetLastActivity.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_last_activity_response"
  Responses::GetLastActivityResponse.new(response.deep_symbolize_keys)
end

#get_long_poll_history(arguments = {}) ⇒ Vk::API::Messages::Responses::GetLongPollHistoryResponse

Returns updates in user's private messages.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :ts (Integer)

    Last value of the 'ts' parameter returned from the Long Poll server or by using method.

  • :pts (Integer)

    Lsat value of 'pts' parameter returned from the Long Poll server or by using method.

  • :preview_length (Integer)

    Number of characters after which to truncate a previewed message. To preview the full message, specify '0'.; "NOTE: Messages are not truncated by default. Messages are truncated by words."

  • :onlines (Boolean)

    '1' — to return history with online users only.

  • :fields (Array) — default: []

    Additional to return.

  • :events_limit (Integer) — default: 1000

    Maximum nimber of events to return.

  • :msgs_limit (Integer) — default: 200

    Maximum number of messages to return.

  • :max_msg_id (Integer)

    Maximum ID of the message among existing ones in the local copy. Both messages received with API methods (for example, , ), and data received from a Long Poll server (events with code 4) are taken into account.

Returns:

See Also:



4297
4298
4299
4300
4301
4302
4303
# File 'lib/vk/api/methods.rb', line 4297

def get_long_poll_history(arguments = {})
  require "vk/api/messages/methods/get_long_poll_history"
  method = Methods::GetLongPollHistory.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_long_poll_history_response"
  Responses::GetLongPollHistoryResponse.new(response.deep_symbolize_keys)
end

#get_long_poll_server(arguments = {}) ⇒ Vk::API::Messages::Responses::GetLongPollServerResponse

Returns data required for connection to a Long Poll server.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :use_ssl (Boolean)

    '1' — to use SSL.

  • :need_pts (Boolean)

    '1' — to return the 'pts' field, needed for the method.

Returns:

See Also:



4279
4280
4281
4282
4283
4284
4285
# File 'lib/vk/api/methods.rb', line 4279

def get_long_poll_server(arguments = {})
  require "vk/api/messages/methods/get_long_poll_server"
  method = Methods::GetLongPollServer.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/get_long_poll_server_response"
  Responses::GetLongPollServerResponse.new(response.deep_symbolize_keys)
end

#mark_as_important(arguments = {}) ⇒ Vk::API::Messages::Responses::MarkAsImportantResponse

Returns Marks and unmarks messages as important (starred).

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :message_ids (Array)

    IDs of messages to mark as important.

  • :important (Integer)

    '1' — to add a star (mark as important); '0' — to remove the star

Returns:

See Also:



4267
4268
4269
4270
4271
4272
4273
# File 'lib/vk/api/methods.rb', line 4267

def mark_as_important(arguments = {})
  require "vk/api/messages/methods/mark_as_important"
  method = Methods::MarkAsImportant.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/mark_as_important_response"
  Responses::MarkAsImportantResponse.new(response.deep_symbolize_keys)
end

#mark_as_read(arguments = {}) ⇒ Vk::API::Messages::Responses::MarkAsReadResponse

Returns Marks messages as read.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :message_ids (Array)

    IDs of messages to mark as read.

  • :peer_id (String)

    Destination ID.; ; "For user:; 'User ID', e.g. '12345'.; ; For chat:; '2000000000' + 'chat_id', e.g. '2000000001'.; ; For community:; '- community ID', e.g. '-12345'.; "

  • :start_message_id (Integer)

    Message ID to start from.

Returns:

See Also:



4255
4256
4257
4258
4259
4260
4261
# File 'lib/vk/api/methods.rb', line 4255

def mark_as_read(arguments = {})
  require "vk/api/messages/methods/mark_as_read"
  method = Methods::MarkAsRead.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/mark_as_read_response"
  Responses::MarkAsReadResponse.new(response.deep_symbolize_keys)
end

#remove_chat_user(arguments = {}) ⇒ Vk::API::Messages::Responses::RemoveChatUserResponse

Returns Allows the current user to leave a chat or, if the current user started the chat, allows the user to remove another user from the chat.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :chat_id (Integer)

    Chat ID.

  • :user_id (String)

    ID of the user to be removed from the chat.

Returns:

See Also:



4399
4400
4401
4402
4403
4404
4405
# File 'lib/vk/api/methods.rb', line 4399

def remove_chat_user(arguments = {})
  require "vk/api/messages/methods/remove_chat_user"
  method = Methods::RemoveChatUser.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/remove_chat_user_response"
  Responses::RemoveChatUserResponse.new(response.deep_symbolize_keys)
end

#restore(arguments = {}) ⇒ Vk::API::Messages::Responses::RestoreResponse

Returns Restores a deleted message.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :message_id (Integer)

    ID of a previously-deleted message to restore.

Returns:

See Also:



4242
4243
4244
4245
4246
4247
4248
# File 'lib/vk/api/methods.rb', line 4242

def restore(arguments = {})
  require "vk/api/messages/methods/restore"
  method = Methods::Restore.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/restore_response"
  Responses::RestoreResponse.new(response.deep_symbolize_keys)
end

#search(arguments = {}) ⇒ Vk::API::Messages::Responses::SearchResponse

Returns a list of the current user's private messages that match search criteria.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :q (String)

    Search query string.

  • :peer_id (Integer)

    Destination ID.; ; "For user:; 'User ID', e.g. '12345'.; ; For chat:; '2000000000' + 'chat_id', e.g. '2000000001'.; ; For community:; '- community ID', e.g. '-12345'.; "

  • :date (Integer)

    Date to search message before in Unixtime.

  • :count (Integer) — default: 20

    Number of messages to return.

Returns:

See Also:



4150
4151
4152
4153
4154
4155
4156
# File 'lib/vk/api/methods.rb', line 4150

def search(arguments = {})
  require "vk/api/messages/methods/search"
  method = Methods::Search.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/search_response"
  Responses::SearchResponse.new(response.deep_symbolize_keys)
end

#search_dialogs(arguments = {}) ⇒ Vk::API::Messages::Responses::SearchDialogsResponse

Returns a list of the current user's conversations that match search criteria.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :q (String)

    Search query string.

  • :limit (Integer) — default: 20

    Maximum number of results.

  • :fields (Array)

    Profile fields to return.;

Returns:

See Also:



4375
4376
4377
4378
4379
4380
4381
# File 'lib/vk/api/methods.rb', line 4375

def search_dialogs(arguments = {})
  require "vk/api/messages/methods/search_dialogs"
  method = Methods::SearchDialogs.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/search_dialogs_response"
  Responses::SearchDialogsResponse.new(response.deep_symbolize_keys)
end

#send(arguments = {}) ⇒ Vk::API::Messages::Responses::SendResponse

Returns Sends a message.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :user_id (Integer)

    User ID (by default — current user).

  • :random_id (Integer)

    Unique identifier to avoid resending the message.

  • :peer_id (Integer)

    Destination ID.; ; "For user:; 'User ID', e.g. '12345'.; ; For chat:; '2000000000' + 'chat_id', e.g. '2000000001'.; ; For community:; '- community ID', e.g. '-12345'.; "

  • :domain (String)

    User's short address (for example, 'illarionov').

  • :chat_id (Integer)

    ID of conversation the message will relate to.

  • :user_ids (Array)

    IDs of message recipients (if new conversation shall be started).

  • :message (String) — default: Required if 'attachments' is not set.

    Text of the message.

  • :lat (Number)

    Geographical latitude of a check-in, in degrees (from -90 to 90).

  • :long (Number)

    Geographical longitude of a check-in, in degrees (from -180 to 180).

  • :attachment (String) — default: Required if 'message' is not set.

    List of objects attached to the message, separated by commas, in the following format:; "_"; '' — Type of media attachment:; 'photo' — photo; 'video' — video; 'audio' — audio; 'doc' — document; 'wall' — wall post; '' — ID of the media attachment owner.; '' — media attachment ID.; ; Example:; "photo100172_166443618"

  • :forward_messages (String)

    ID of forwarded messages, separated with a comma. Listed messages of the sender will be shown in the message body at the recipient's.; ; Example:; "123,431,544"

  • :sticker_id (Integer)

    Sticker id.

  • :notification (Boolean)

    '1' if the message is a notification (for community messages).

Returns:

See Also:



4205
4206
4207
4208
4209
4210
4211
# File 'lib/vk/api/methods.rb', line 4205

def send(arguments = {})
  require "vk/api/messages/methods/send"
  method = Methods::Send.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/send_response"
  Responses::SendResponse.new(response.deep_symbolize_keys)
end

#set_activity(arguments = {}) ⇒ Vk::API::Messages::Responses::SetActivityResponse

Returns Changes the status of a user as typing in a conversation.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :user_id (String)

    User ID.

  • :type (String)

    'typing' — user has started to type.

  • :peer_id (Integer)

    Destination ID.; ; "For user:; 'User ID', e.g. '12345'.; ; For chat:; '2000000000' + 'chat_id', e.g. '2000000001'.; ; For community:; '- community ID', e.g. '-12345'.; "

Returns:

See Also:



4362
4363
4364
4365
4366
4367
4368
# File 'lib/vk/api/methods.rb', line 4362

def set_activity(arguments = {})
  require "vk/api/messages/methods/set_activity"
  method = Methods::SetActivity.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/set_activity_response"
  Responses::SetActivityResponse.new(response.deep_symbolize_keys)
end

#set_chat_photo(arguments = {}) ⇒ Vk::API::Messages::Responses::SetChatPhotoResponse

Returns Sets a previously-uploaded picture as the cover picture of a chat.

Parameters:

  • arguments (Hash) (defaults to: {})

Options Hash (arguments):

  • :file (String)

    Upload URL from the 'response' field returned by the method upon successfully uploading an image.

Returns:

See Also:



4421
4422
4423
4424
4425
4426
4427
# File 'lib/vk/api/methods.rb', line 4421

def set_chat_photo(arguments = {})
  require "vk/api/messages/methods/set_chat_photo"
  method = Methods::SetChatPhoto.new(arguments)
  response = method.call(@client)
  require "vk/api/messages/responses/set_chat_photo_response"
  Responses::SetChatPhotoResponse.new(response.deep_symbolize_keys)
end