node-vk-api-bot
Version:
A library that helps you to create chat-bot for group or user
896 lines (895 loc) • 27.3 kB
TypeScript
import { flag } from './utils.js';
export declare namespace Objects {
type Message = Basic.Message;
type Photo = MediaContentAndAttachments.Photo;
type WallReply = Basic.WallReply;
type ClientInfo = Auxiliary.client_info;
type Audio = MediaContentAndAttachments.Audio;
type Video = MediaContentAndAttachments.Video;
type Wall = Basic.Wall;
type BoardReply = Objects.Basic.TopicReply;
type Order = Objects.Basic.Order;
type User = Basic.User;
type Chat = Basic.Chat;
type Group = Basic.Group;
type Conversation = Basic.Conversation;
type Doc = MediaContentAndAttachments.Doc;
type Link = MediaContentAndAttachments.Link;
type MarketItem = Basic.MarketAlbum;
type Address = Basic.Address;
namespace Basic {
interface User {
id: number;
first_name: string;
last_name: string;
deactivated?: 'deleted' | 'banned';
is_closed: boolean;
can_access_closed?: boolean;
[x: string]: unknown;
}
interface Group {
id: number;
name: string;
screen_name: string;
is_closed: flag | 2;
deactivated?: 'deleted' | 'banned';
is_admin?: flag;
admin_level?: 1 | 2 | 3;
is_member?: flag;
is_advertiser?: flag;
invited_by?: number;
type: 'group' | 'page' | 'event';
photo_50: string;
photo_100: string;
photo_200: string;
}
interface Wall {
id: number;
owner_id: number;
from_id: number;
created_by: number;
date: number;
test: string;
reply_owner_id?: number;
reply_post_id?: number;
friends_only?: 1;
comments: {
count: number;
can_post?: flag;
groups_can_post: flag;
can_close?: boolean;
can_open?: boolean;
};
copyright: {
id: number;
link?: string;
name?: string;
type?: string;
};
likes: {
count: number;
user_likes?: flag;
can_like?: flag;
can_publish?: flag;
};
reposts: {
count: number;
user_reposted?: flag;
};
views: {
count: number;
};
post_type: 'post' | 'copy' | 'reply' | 'postpone' | 'suggest';
attachments: Objects.MediaContentAndAttachments.Mediacontent.wall[];
geo?: {
type: string;
coordinates: string;
place?: {
id: number;
name: string;
latitude: number;
longitude: number;
created: number;
icon: string;
checkins: number;
updated: number;
type: number;
country: number;
city: number;
address: string;
};
};
post_source: {
type: 'vk' | 'widget' | 'api' | 'rss' | 'sms';
platform: 'android' | 'iphone' | 'wphone';
data: 'profile_activity' | 'profile_photo' | 'comments' | 'like' | 'poll';
url: string;
};
signer_id?: number;
can_pin: flag;
can_delete: flag;
can_edit: flag;
is_pinned?: 1;
marked_as_ads: flag;
is_favorite?: flag;
donut: {
is_donut: boolean;
paid_duration: number;
placeholder: string;
can_publish_free_copy: boolean;
edit_mode: 'all' | 'duration';
};
postponed_id?: number;
}
interface WallReply {
id: number;
from_id: number;
date: number;
text: string;
donut: {
is_don: boolean;
placeholder: string;
};
reply_to_user?: number;
reply_to_comment?: number;
attachments?: Objects.MediaContentAndAttachments.Mediacontent.wall[];
parents_stack?: number[];
thread: {
count: number;
can_post: boolean;
show_reply_button: boolean;
groups_can_post: boolean;
};
}
interface Message {
id: number;
date: number;
peer_id: number;
from_id: number;
text: string;
random_id: number;
ref?: string;
ref_source?: string;
attachments?: Objects.MediaContentAndAttachments.Mediacontent.Message[];
important: boolean;
geo?: {
type: string;
coordinates: {
latitude: number;
longitude: number;
};
place: {
id: number;
title: string;
latitude: number;
longitude: number;
created: number;
icon: string;
country: string;
city: string;
};
showmap: number;
};
payload?: string;
fwd_messages?: Message[];
reply_message?: Message;
action?: {
type: 'chat_photo_update' | 'chat_photo_remove' | 'chat_create' | 'chat_title_update' | 'chat_invite_user' | 'chat_kick_user' | 'chat_pin_message' | 'chat_unpin_message' | 'chat_invite_user_by_link';
member_id: number;
text: string;
email: string;
photo: {
[K in `photo_${50 | 100 | 200}`]: string;
};
};
admin_author_id?: number;
conversation_message_id: number;
is_cropped?: boolean;
members_count: number;
update_time?: number;
was_listened?: boolean;
pinned_at?: number;
message_tag?: string;
}
interface Conversation {
peer: {
id: number;
type: 'user' | 'chat' | 'group' | 'email';
local_id: number;
};
in_read: number;
out_read: number;
unread_count: number;
important: boolean;
unanswered: boolean;
push_settings: {
disabled_until: number;
disabled_forever?: true;
no_sound?: true;
};
can_write: {
allowed: boolean;
reason?: 18 | 203 | 900 | 901 | 902 | 915 | 916 | 917 | 918;
};
chat_settings: {
members_count: number;
title: string;
pinned_message?: Message;
state: 'in' | 'kicked' | 'left';
photo: {
[K in `photo_${50 | 100 | 200}`]: string;
};
active_ids: number[];
is_group_channel: boolean;
};
}
interface Chat {
id: number;
type: string;
title: string;
admin_id: number;
users: number[];
push_settings: {
sound: flag;
disabled_until: number;
};
photo_50?: string;
photo_100?: string;
photo_200?: string;
left?: 1;
kicked?: 1;
}
interface Note {
owner_id: number;
id: number;
title: string;
test: string;
date: number;
comments: number;
read_comments?: number;
view_url: string;
privacy_view: string[];
privacy_comment: string[];
can_comment?: number;
text_wiki?: string;
}
interface WikiPage {
id: number;
group_id: number;
creator_id: number;
title: string;
current_user_can_edit?: flag;
current_user_can_edit_access?: flag;
who_can_view: flag | 2;
who_can_edit: flag | 2;
edited?: number;
created?: number;
editor_id: number;
views: number;
parent?: string;
parent2?: string;
source?: string;
html?: string;
view_url: string;
}
interface MarketItem {
id: number;
owner_id: number;
title: string;
description: string;
price: {
amount: string;
currency: {
id: number;
name: string;
};
old_amount: string;
text: string;
};
dimensions: {
width: number;
height: number;
length: number;
};
weight: number;
category: {
id: number;
name: string;
section: {
id: number;
name: string;
};
};
thumb_photo: string;
date: number;
availability: flag | 2;
is_favorite?: boolean;
sku: string;
}
interface MarketAlbum {
id: number;
owner_id: number;
title: string;
photo: MediaContentAndAttachments.Photo;
count: number;
updated_time?: number;
}
interface Order {
id: number;
group_id: number;
user_id: number;
date: number;
variants_grouping_id: number;
is_main_variant: boolean;
property_values: {
variant_id: number;
variant_name: string;
property_name: string;
}[];
cart_quantity: number;
status: flag | 2 | 3 | 4 | 5 | 6;
items_count: number;
total_price: {
amount: string;
currency: {
id: number;
name: string;
};
text: string;
};
display_order_id: string;
comment: string;
preview_order_items: MarketItem[];
delivery: {
address: string;
type: string;
track_number: string;
track_link: string;
delivery_point: unknown;
};
recipient: {
name: string;
phone: string;
display_text: string;
};
}
interface Discussion {
id: number;
title: string;
created: number;
updated: number;
updated_by: number;
is_closed: flag;
is_fixed: flag;
comments: number;
first_comment: string;
last_comment: string;
}
interface TopicReply {
id: number;
from_id: number;
date: number;
text: string;
attachments: Objects.MediaContentAndAttachments.Mediacontent.wall[];
likes?: {
count: number;
user_likes: flag;
can_like: flag;
};
}
interface App {
id: number;
title: string;
icon_278: string;
icon_139: string;
icon_150: string;
icon_75: string;
banner_560: string;
banner_1120: string;
type: 'app' | 'game' | 'site' | 'standalone';
section: string;
author_url: string;
author_id: number;
author_group: number;
members_count: number;
published_date: number;
catalog_position: number;
international: flag;
leaderboard_type: flag | 2;
genre_id: number;
genre: string;
platform_id: number;
is_in_catalog: flag;
friends?: number[];
installed?: flag;
is_html5_app?: 1;
screen_orientation: flag | 2;
mobile_controls_type: flag;
mobile_view_type_support: flag;
}
interface Poll {
id: number;
owner_id: number;
created: number;
votes: number;
question: string;
answers: {
id: number;
test: string;
votes: number;
rate: number;
}[];
anonymous: boolean;
multiple: boolean;
answer_idS?: number[];
end_date: number;
closed: boolean;
is_board: boolean;
can_edit: boolean;
can_vote: boolean;
can_report: boolean;
can_share: boolean;
author_id: number;
photo: MediaContentAndAttachments.Photo;
background: {
id: number;
type: 'gradient' | 'tile';
angle?: number;
color: string;
width?: number;
height?: number;
images?: {
url: string;
width: number;
height: number;
type: 's' | 'm' | 'x' | 'o' | 'p' | 'q' | 'r' | 'y' | 'z' | 'w';
}[];
points?: {
position: number;
color: string;
}[];
};
friends?: number[];
}
interface Statistics {
activity: {
comments: number;
copies: number;
hidden: number;
liked: number;
subscribed: number;
unsubscribed: number;
};
period_from: number;
period_to: number;
visitors: {
views: number;
visitors: number;
};
reach: {
reach: number;
reach_subscribers: number;
mobile_reach: number;
sex: Auxiliary.sex[];
age: Auxiliary.age[];
sex_age: {
value: `${Auxiliary.sex['value']};${Auxiliary.age['value']}`;
count: number;
}[];
cities: {
name: string;
city_id: number | 'other';
count: number;
}[];
countries: {
name: string;
code: string;
country_id: number;
count: number;
}[];
};
}
interface Address {
id: number;
country_id: number;
city_id: number;
title: string;
address: string;
additional_address: string;
latitude: number;
longitude: number;
distance: number;
phone: string;
time_offset: number;
metro_station_id: number;
work_info_status: 'no_information' | 'temporarily_closed' | 'always_opened' | 'forever_closed' | 'timetable';
timetable?: unknown;
}
}
namespace MediaContentAndAttachments {
interface Photo {
id: number;
album_id: number;
owner_id: number;
user_id: number;
text: string;
date: string;
sizes: {
type: string;
url: string;
width: number;
height: number;
}[];
width?: number;
height?: number;
}
interface Audio {
id: number;
owner_id: number;
artist: string;
title: string;
duration: number;
url: string;
lyrics_id?: number;
genre_id: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 1001;
date: number;
no_search?: 1;
is_hq?: 1;
}
interface Video {
id: number;
owner_id: number;
title: string;
description: string;
duration: number;
image: Auxiliary.img;
first_frame: Auxiliary.frame;
date: number;
adding_date: number;
views: number;
local_views: number;
comments: number;
player: string;
platform?: string;
can_add: flag;
is_private?: 1;
access_key: string;
processing?: 1;
is_favorite: boolean;
can_edit?: flag;
can_like?: flag;
can_repost?: flag;
can_subscribe?: flag;
can_add_to_faves?: flag;
can_attach_link?: flag;
width: number;
height: number;
converting: flag;
added: flag;
is_subscribed: flag;
repeat?: 1;
type: 'video' | 'music_video' | 'movie';
balance?: number;
live_status: 'waiting' | 'started' | 'finished' | 'failed' | 'upcoming';
live?: 1;
upcoming?: 1;
spectators: number;
likes: {
count: number;
user_liked: flag;
};
reposts: {
count: number;
wall_count: number;
mail_count: number;
user_reposted: number;
};
}
interface Doc {
id: number;
owner_id: number;
title: string;
size: string;
ext: string;
url: string;
date: number;
type: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
preview: {
photo: {
src: string;
width: number;
height: number;
type: string;
}[];
} | {
graffity: {
src: string;
width: number;
height: number;
};
} | {
audio_message: {
duration: number;
waveform: number[];
link_ogg: string;
};
};
}
namespace Mediacontent {
type wall = {
type: 'photo';
photo: Photo;
} | {
type: 'posted_photo';
posted_photo: {
id: number;
owner_id: number;
photo_130: string;
photo_604: string;
};
} | {
type: 'video';
video: Video;
} | {
type: 'audio';
audio: Audio;
} | {
type: 'doc';
doc: Doc;
} | {
type: 'graffity';
graffity: {
id: number;
owner_id: number;
photo_130: string;
photo_604: string;
};
} | {
type: 'link';
link: Link;
} | {
type: 'note';
note: Objects.Basic.Note;
} | {
type: 'poll';
poll: Objects.Basic.Poll;
} | {
type: 'page';
page: Objects.Basic.WikiPage;
} | {
type: 'album';
album: {
id: number;
thumb: Photo;
owner_id: number;
title: string;
description: string;
created: number;
updated: number;
size: number;
};
} | {
type: 'photo_list';
photo_list: string[];
} | {
type: 'market';
market: Objects.Basic.MarketItem;
} | {
type: 'market_album';
market_album: Objects.Basic.MarketAlbum;
} | {
type: 'sticker';
sticker: Sticker;
} | {
type: 'pretty_cards';
pretty_cards: {
card_id: number;
link_url: string;
title: string;
images: {
url: string;
width: number;
height: number;
}[];
button: unknown;
price: string;
price_old: string;
};
} | {
type: 'event';
event: {
id: number;
time: number;
member_status: 1 | 2 | 3;
is_favorite: boolean;
address: string;
text: string;
button_text: string;
friends: number[];
};
};
type Message = {
type: 'photo';
photo: Photo;
} | {
type: 'video';
video: Video;
} | {
type: 'audio';
audio: Audio;
} | {
type: 'doc';
doc: Doc;
} | {
type: 'link';
link: Link;
} | {
type: 'market';
market: Objects.Basic.MarketItem;
} | {
type: 'market_album';
market_album: Objects.Basic.MarketAlbum;
} | {
type: 'wall';
wall: Omit<Objects.Basic.Wall, 'owner_id'> & {
to_id: number;
};
} | {
type: 'wall_reply';
wall_reply: Objects.Basic.WallReply & {
post_id: number;
owner_id: number;
};
} | {
type: 'sticker';
sticker: Sticker;
} | {
type: 'gift';
gift: Gift;
};
}
interface Link {
url: string;
title: string;
caption?: string;
description: string;
photo?: Photo;
product?: {
price: {
amount: number;
currency: {
id: number;
name: string;
};
test: string;
};
};
button?: {
title: string;
action: {
type: 'open_url';
url: string;
};
};
preview_page: string;
preview_url: string;
}
interface Sticker {
product_id: number;
sticker_id: number;
images: Auxiliary.frame[];
images_with_background: Auxiliary.frame[];
animation_url: string;
is_allowed: boolean;
}
interface Gift {
id: number;
thumb_256: string;
thumb_96: string;
thumb_48: string;
}
interface Geo {
type: string;
coordinates: {
latitude: number;
longitude: number;
};
place?: {
id?: number;
title?: string;
latitude: number;
longitude: number;
created?: number;
icon: string;
country: string;
city: string;
type?: number;
group_id?: number;
group_photo?: string;
checkins?: number;
updated?: number;
address?: string;
};
}
interface Story {
id: number;
owner_id: number;
date: number;
expires_at: number;
is_expired?: boolean;
is_deleted?: boolean;
can_see: flag;
seen?: 1;
type: 'photo' | 'video';
photo?: Photo;
video?: Video & {
[K in `first_frame_${103 | 160 | 320 | 800}`]: string;
} & {
is_private: flag;
};
link: {
text: string;
url: string;
};
parent_story_owner_id?: number;
parent_story_id?: number;
parent_story?: Story;
replies: {
count: number;
new: number;
};
can_reply: flag;
can_share: flag;
can_comment: flag;
clickable_stickers: Clickable_stickers;
view: number;
access_key: string;
}
interface Clickable_stickers {
original_width: number;
original_height: number;
clickable_stickers: {
clickable_area: {
x: number;
y: number;
}[];
style: string;
} & Auxiliary.sticker;
}
}
}
export declare namespace Auxiliary {
type sex = {
value: 'm' | 'f';
count: number;
};
type age = {
value: '12-18' | '18-21' | '21-24' | '24-27' | '27-30' | '30-35' | '35-45' | '45-100';
count: number;
};
type frame = {
height: number;
url: string;
width: number;
};
type img = {
with_padding?: 1;
} & frame;
type sticker = {
type: 'mention';
mention: string;
} | {
type: 'hashtag';
hashtag: string;
};
interface client_info {
button_actions: string[];
keyboard: boolean;
inline_keyboard: boolean;
carousel: boolean;
lang_id: number;
}
type param = {
[key: string]: unknown;
};
}