Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
long: typing.Any = None,
attachment: str = None,
reply_to: int = None,
forward_messages: typing.List = None,
forward: str = None,
sticker_id: int = None,
group_id: int = None,
keyboard: str = None,
payload: str = None,
dont_parse_links: bool = None,
disable_mentions: bool = None,
expire_ttl: int = None,
silent: bool = None,
template: dict = None,
intent: str = None,
) -> responses.messages.Send:
""" messages.send
From Vk Docs: Sends a message.
Access from user, group token(s)
:param user_id: User ID (by default — current user).
:param random_id: Unique identifier to avoid resending the message.
:param peer_id: Destination ID. "For user: 'User ID', e.g. '12345'. For chat: '2000000000' + 'chat_id', e.g. '2000000001'. For community: '- community ID', e.g. '-12345'. "
:param domain: User's short address (for example, 'illarionov').
:param chat_id: ID of conversation the message will relate to.
:param user_ids: IDs of message recipients (if new conversation shall be started).
:param message: (Required if 'attachments' is not set.) Text of the message.
:param lat: Geographical latitude of a check-in, in degrees (from -90 to 90).
:param long: Geographical longitude of a check-in, in degrees (from -180 to 180).
:param attachment: (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"
:param reply_to:
:param forward_messages: 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"
:param forward:
:param start_message_id: Starting message ID from which to return history.
:param rev: Sort order: '1' — return messages in chronological order. '0' — return messages in reverse chronological order.
:param extended: Information whether the response should be extended
:param fields: Profile fields to return.
:param group_id: Group ID (for group messages with group access token)
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
if k not in ["self"] and v is not None
}
return await self.request(
"messages.getHistory",
params,
response_model=responses.messages.GetHistoryModel,
)
:param max_msg_id: 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.
:param group_id: Group ID (for group messages with user access token)
:param lp_version:
:param last_n:
:param credentials:
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
if k not in ["self"] and v is not None
}
return await self.request(
"messages.getLongPollHistory",
params,
response_model=responses.messages.GetLongPollHistoryModel,
)
async def __call__(
self,
offset: int = None,
count: int = None,
filter: str = None,
extended: bool = None,
start_message_id: int = None,
fields: typing.List = None,
group_id: int = None,
) -> responses.messages.GetConversations:
""" messages.getConversations
From Vk Docs: Returns a list of the current user's conversations.
Access from user, group token(s)
:param offset: Offset needed to return a specific subset of conversations.
:param count: Number of conversations to return.
:param filter: Filter to apply: 'all' — all conversations, 'unread' — conversations with unread messages, 'important' — conversations, marked as important (only for community messages), 'unanswered' — conversations, marked as unanswered (only for community messages)
:param extended: '1' — return extra information about users and communities
:param start_message_id: ID of the message from what to return dialogs.
:param fields: Profile and communities fields to return.
:param group_id: Group ID (for group messages with group access token)
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
if k not in ["self"] and v is not None
:param peer_id: Destination ID. "For user: 'User ID', e.g. '12345'. For chat: '2000000000' + 'chat_id', e.g. '2000000001'. For community: '- community ID', e.g. '-12345'. "
:param conversation_message_ids: Conversation message IDs.
:param extended: Information whether the response should be extended
:param fields: Profile fields to return.
:param group_id: Group ID (for group messages with group access token)
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
if k not in ["self"] and v is not None
}
return await self.request(
"messages.getByConversationMessageId",
params,
response_model=responses.messages.GetByConversationMessageIdModel,
)
From Vk Docs: Returns data required for connection to a Long Poll server.
Access from user, group token(s)
:param need_pts: '1' — to return the 'pts' field, needed for the [vk.com/dev/messages.getLongPollHistory|messages.getLongPollHistory] method.
:param group_id: Group ID (for group messages with user access token)
:param lp_version: Long poll version
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
if k not in ["self"] and v is not None
}
return await self.request(
"messages.getLongPollServer",
params,
response_model=responses.messages.GetLongPollServerModel,
)
async def __call__(
self, peer_id: int, message_id: int = None
) -> responses.messages.Pin:
""" messages.pin
From Vk Docs: Pin a message.
Access from user, group token(s)
:param peer_id: Destination ID. "For user: 'User ID', e.g. '12345'. For chat: '2000000000' + 'Chat ID', e.g. '2000000001'. For community: '- Community ID', e.g. '-12345'. "
:param message_id:
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
if k not in ["self"] and v is not None
}
return await self.request(
"messages.pin", params, response_model=responses.messages.PinModel
)
""" messages.deleteChatPhoto
From Vk Docs: Deletes a chat's cover picture.
Access from user, group token(s)
:param chat_id: Chat ID.
:param group_id:
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
if k not in ["self"] and v is not None
}
return await self.request(
"messages.deleteChatPhoto",
params,
response_model=responses.messages.DeleteChatPhotoModel,
)
async def __call__(
self, user_id: int = None, peer_id: int = None, group_id: int = None
) -> responses.messages.DeleteConversation:
""" messages.deleteConversation
From Vk Docs: Deletes all private messages in a conversation.
Access from user, group token(s)
:param user_id: User ID. To clear a chat history use 'chat_id'
:param peer_id: Destination ID. "For user: 'User ID', e.g. '12345'. For chat: '2000000000' + 'chat_id', e.g. '2000000001'. For community: '- community ID', e.g. '-12345'. "
:param group_id: Group ID (for group messages with user access token)
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
if k not in ["self"] and v is not None
}
return await self.request(
"messages.deleteConversation",
params,
From Vk Docs: Deletes all private messages in a conversation.
Access from user, group token(s)
:param user_id: User ID. To clear a chat history use 'chat_id'
:param peer_id: Destination ID. "For user: 'User ID', e.g. '12345'. For chat: '2000000000' + 'chat_id', e.g. '2000000001'. For community: '- community ID', e.g. '-12345'. "
:param group_id: Group ID (for group messages with user access token)
"""
params = {
k if not k.endswith("_") else k[:-1]: v
for k, v in {**locals(), **self.kwargs}.items()
if k not in ["self"] and v is not None
}
return await self.request(
"messages.deleteConversation",
params,
response_model=responses.messages.DeleteConversationModel,
)