UNPKG

vvlad1973-telegram-framework

Version:
98 lines (80 loc) 2.39 kB
'use strict' import { BotCommandScopeTypes } from './enums.js'; export class BotCommandScope { type; constructor(type, chatId, userId) { switch (type) { case BotCommandScopeTypes.ALL_PRIVATE_CHATS: { this.type = BotCommandScopeTypes.ALL_PRIVATE_CHATS; break; } case BotCommandScopeTypes.ALL_GROUP_CHATS: { this.type = BotCommandScopeTypes.ALL_GROUP_CHATS; break; } case BotCommandScopeTypes.ALL_CHAT_ADMINISTRATORS: { this.type = BotCommandScopeTypes.ALL_CHAT_ADMINISTRATORS; break; } case BotCommandScopeTypes.CHAT: { this.type = BotCommandScopeTypes.CHAT; this.chatId = chatId; break; } case BotCommandScopeTypes.CHAT_ADMINISTRATORS: { this.type = BotCommandScopeTypes.CHAT_ADMINISTRATORS; this.chatId = chatId; break; } case BotCommandScopeTypes.CHAT_MEMBER: { this.type = BotCommandScopeTypes.CHAT_MEMBER this.chatId = chatId; this.user_id = userId } default: { this.type = BotCommandScopeTypes.DEFAULT; } } } } export class BotCommandScopeDefault extends BotCommandScope { constructor() { super(BotCommandScopeTypes.DEFAULT); } } export class BotCommandScopeAllPrivateChats extends BotCommandScope { constructor() { super(BotCommandScopeTypes.ALL_PRIVATE_CHATS); } } export class BotCommandScopeAllGroupChats extends BotCommandScope { constructor() { super(BotCommandScopeTypes.ALL_GROUP_CHATS); } } export class BotCommandScopeAllChatAdministrators extends BotCommandScope { constructor() { super(BotCommandScopeTypes.ALL_CHAT_ADMINISTRATORS); } } export class BotCommandScopeChat extends BotCommandScope { chat_id; constructor(chatId) { super(BotCommandScopeTypes.CHAT); this.chat_id = chatId; } } export class BotCommandScopeChatAdministrators extends BotCommandScopeChat { constructor(chatId) { super(chatId); this.type = BotCommandScopeTypes.CHAT_ADMINISTRATORS; } } export class BotCommandScopeChatMember extends BotCommandScopeChat { user_id; constructor(chatId, userId) { super(chatId); this.type = BotCommandScopeTypes.CHAT_MEMBER; this.user_id = userId; } }