Skip to content

Commit 1d521c7

Browse files
committed
chore: move cluster types
1 parent ef79d26 commit 1d521c7

File tree

7 files changed

+57
-57
lines changed

7 files changed

+57
-57
lines changed

src/index.ts

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { HexColorString } from 'discord.js';
2-
3-
import { AttachmentTypeUnion, Handler, Storage, VK } from './modules';
1+
import { Handler, ICluster, Storage } from './modules';
42

53
// @ts-ignore
64
import config from '../config.json';
@@ -10,46 +8,6 @@ export interface IConfig {
108
version_dont_modify_me: number;
119
}
1210

13-
export interface IVKParams {
14-
token: string;
15-
group_id: string;
16-
keywords: string[];
17-
words_blacklist: string[];
18-
filter: boolean;
19-
donut: boolean;
20-
ads: boolean;
21-
longpoll: boolean;
22-
interval: number;
23-
}
24-
25-
export enum Exclude {
26-
TEXT = 'text',
27-
ATTACHMENTS = 'attachments',
28-
REPOST_TEXT = 'repost_text',
29-
REPOST_ATTACHMENTS = 'repost_attachments'
30-
}
31-
32-
export interface IDiscordParams {
33-
webhook_urls: string[];
34-
username: string;
35-
avatar_url: string;
36-
content: string;
37-
color: HexColorString;
38-
author: boolean;
39-
copyright: boolean;
40-
date: boolean;
41-
exclude_content: (AttachmentTypeUnion | Exclude)[];
42-
}
43-
44-
export interface ICluster {
45-
vk: IVKParams;
46-
discord: IDiscordParams;
47-
48-
VK: VK;
49-
storage: Storage;
50-
index: number;
51-
}
52-
5311
const { clusters } = config as unknown as IConfig;
5412

5513
console.log('[VK2Discord] Запущен.');

src/modules/Attachments.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { MessageEmbed, MessageAttachment } from 'discord.js';
22
import { AttachmentType, ISharedAttachmentPayload, AttachmentTypeString } from 'vk-io';
33

4-
import { Message } from './';
5-
import { ICluster } from '../';
4+
import { Message } from './Message';
5+
import { ICluster } from './Handler';
66

77
import { generateRandomString, LINK_PREFIX } from '../utils';
88

@@ -18,7 +18,7 @@ const { AUDIO, DOCUMENT, LINK, PHOTO, POLL, VIDEO, ALBUM, MARKET, MARKET_ALBUM }
1818

1919
export class Attachments {
2020

21-
private cluster: ICluster;
21+
private readonly cluster: ICluster;
2222

2323
constructor(cluster: Attachments['cluster']) {
2424
this.cluster = cluster;

src/modules/Handler.ts

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,53 @@
11
import { IWallPostContextPayload } from 'vk-io';
22
import { GroupsGetByIdObjectLegacyResponse, UsersGetResponse } from 'vk-io/lib/api/schemas/responses';
3-
import { MessageEmbed } from 'discord.js';
3+
import { HexColorString, MessageEmbed } from 'discord.js';
44

5-
import { Sender, Storage, TokenType, VK } from './';
5+
import { Sender } from './Sender';
6+
import { Storage } from './Storage';
7+
import { VK, TokenType } from './VK';
8+
import { AttachmentTypeUnion } from './Attachments';
69

710
import { getById, getPostAuthor, getPostLink, getResourceId, IGetPostLinkOptions } from '../utils';
811

9-
import { ICluster } from '../';
12+
export interface IVKParams {
13+
token: string;
14+
group_id: string;
15+
keywords: string[];
16+
words_blacklist: string[];
17+
filter: boolean;
18+
donut: boolean;
19+
ads: boolean;
20+
longpoll: boolean;
21+
interval: number;
22+
}
23+
24+
export enum Exclude {
25+
TEXT = 'text',
26+
ATTACHMENTS = 'attachments',
27+
REPOST_TEXT = 'repost_text',
28+
REPOST_ATTACHMENTS = 'repost_attachments'
29+
}
30+
31+
export interface IDiscordParams {
32+
webhook_urls: string[];
33+
username: string;
34+
avatar_url: string;
35+
content: string;
36+
color: HexColorString;
37+
author: boolean;
38+
copyright: boolean;
39+
date: boolean;
40+
exclude_content: (AttachmentTypeUnion | Exclude)[];
41+
}
42+
43+
export interface ICluster {
44+
vk: IVKParams;
45+
discord: IDiscordParams;
46+
47+
VK: VK;
48+
storage: Storage;
49+
index: number;
50+
}
1051

1152
export class Handler {
1253

src/modules/Markdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import replaceAsync from 'string-replace-async';
22

3-
import { VK } from './';
3+
import { VK } from './VK';
44

55
import { LINK_PREFIX } from '../utils';
66

src/modules/Message.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { MessageAttachment, MessageEmbed } from 'discord.js';
22
import { IWallPostContextPayload } from 'vk-io';
33

4-
import { Attachment, Attachments, Markdown } from './';
5-
6-
import { Exclude, ICluster } from '../';
4+
import { Attachment, Attachments } from './Attachments';
5+
import { Markdown } from './Markdown';
6+
import { Exclude, ICluster } from './Handler';
77

88
export enum PostType {
99
POST = 'post',

src/modules/Sender.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { WebhookClient } from 'discord.js';
22
import { IWallPostContextPayload } from 'vk-io';
33

4-
import { FieldType, Keywords, KeywordsType, Message } from './';
5-
6-
import { ICluster } from '../';
4+
import { Keywords, KeywordsType } from './Keywords';
5+
import { Message } from './Message';
6+
import { FieldType } from './Storage';
7+
import { ICluster } from './Handler';
78

89
export class Sender extends Message {
910

src/modules/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export * from './Attachments';
21
export * from './Handler';
2+
export * from './Attachments';
33
export * from './Keywords';
44
export * from './Markdown';
55
export * from './Message';

0 commit comments

Comments
 (0)