mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-04-25 23:16:41 +07:00
initial
This commit is contained in:
commit
ddefc2743a
21 changed files with 873 additions and 0 deletions
9
src/service/telegram/index.ts
Normal file
9
src/service/telegram/index.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { TelegramConfig } from './types';
|
||||
|
||||
export class TelegramService {
|
||||
constructor(private props: TelegramConfig) {
|
||||
if (!props.key) {
|
||||
throw new Error('Telegram api key not found. Get it from bot father')
|
||||
}
|
||||
}
|
||||
}
|
4
src/service/telegram/types.ts
Normal file
4
src/service/telegram/types.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
export interface TelegramConfig {
|
||||
key: string
|
||||
webhookUrl?: string
|
||||
}
|
6
src/service/telegram/validation.ts
Normal file
6
src/service/telegram/validation.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
import * as yup from 'yup';
|
||||
|
||||
export const telegramConfigSchema = yup.object().required().shape({
|
||||
key: yup.string().required(),
|
||||
webhookUrl: yup.string().notRequired(),
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue