Class: Vk::API::Messages::Methods::Send

Inherits:
Schema::Method show all
Defined in:
lib/vk/api/messages/methods/send.rb

Overview

Sends a message.

Arguments collapse

Instance Method Summary collapse

Methods inherited from Schema::Method

#call, #method, #to_hash

Constructor Details

#initialize(arguments) ⇒ Messages::Methods::Send

Parameters:

  • arguments (Hash)

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).


# File 'lib/vk/api/messages/methods/send.rb', line 15

Instance Method Details

#attachmentString

Returns (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".

Returns:

  • (String)

    (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"


53
# File 'lib/vk/api/messages/methods/send.rb', line 53

attribute :attachment, API::Types::Coercible::String.optional.default(nil)

#chat_idInteger

Returns ID of conversation the message will relate to.

Returns:

  • (Integer)

    ID of conversation the message will relate to.


43
# File 'lib/vk/api/messages/methods/send.rb', line 43

attribute :chat_id, API::Types::Coercible::Int.optional.default(nil)

#domainString

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

Returns:

  • (String)

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


41
# File 'lib/vk/api/messages/methods/send.rb', line 41

attribute :domain, API::Types::Coercible::String.optional.default(nil)

#forward_messagesString

Returns 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".

Returns:

  • (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"


55
# File 'lib/vk/api/messages/methods/send.rb', line 55

attribute :forward_messages, API::Types::Coercible::String.optional.default(nil)

#latNumber

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

Returns:

  • (Number)

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


49
# File 'lib/vk/api/messages/methods/send.rb', line 49

attribute :lat, API::Types::Coercible::Int.optional.default(nil)

#longNumber

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

Returns:

  • (Number)

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


51
# File 'lib/vk/api/messages/methods/send.rb', line 51

attribute :long, API::Types::Coercible::Int.optional.default(nil)

#messageString

Returns (Required if 'attachments' is not set.) Text of the message.

Returns:

  • (String)

    (Required if 'attachments' is not set.) Text of the message.


47
# File 'lib/vk/api/messages/methods/send.rb', line 47

attribute :message, API::Types::Coercible::String.optional.default(nil)

#notificationBoolean

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

Returns:

  • (Boolean)

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


59
# File 'lib/vk/api/messages/methods/send.rb', line 59

attribute :notification, API::Types::Form::Bool.optional.default(nil)

#peer_idInteger

Returns 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:

  • (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'.; "


39
# File 'lib/vk/api/messages/methods/send.rb', line 39

attribute :peer_id, API::Types::Coercible::Int.optional.default(nil)

#random_idInteger

Returns Unique identifier to avoid resending the message.

Returns:

  • (Integer)

    Unique identifier to avoid resending the message.


37
# File 'lib/vk/api/messages/methods/send.rb', line 37

attribute :random_id, API::Types::Coercible::Int.optional.default(nil)

#sticker_idInteger

Returns Sticker id.

Returns:

  • (Integer)

    Sticker id.


57
# File 'lib/vk/api/messages/methods/send.rb', line 57

attribute :sticker_id, API::Types::Coercible::Int.optional.default(nil)

#user_idInteger

Returns User ID (by default — current user).

Returns:

  • (Integer)

    User ID (by default — current user).


35
# File 'lib/vk/api/messages/methods/send.rb', line 35

attribute :user_id, API::Types::Coercible::Int.optional.default(nil)

#user_idsArray

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

Returns:

  • (Array)

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


45
# File 'lib/vk/api/messages/methods/send.rb', line 45

attribute :user_ids, API::Types::Coercible::Array.member(API::Types::Coercible::Int).optional.default(nil)