Spaces:
Running
Running
| class ChatClient { | |
| constructor() { | |
| this.client_id = "TELEGRAM_BOT_TOKEN"; | |
| this.tan_client = "YourTanClientToken"; | |
| } | |
| sendMessage(message) { | |
| let chatID = 0; | |
| chatID = messsage?._chatID; | |
| if(!chatID) return false; | |
| const self = this; | |
| // Create bot | |
| const _bot = new Telegus(); | |
| // Set token | |
| _bot.setToken(this.client_id); | |
| // Přidat produkt | |
| if (typeof message !== "string") { | |
| // Create chat | |
| _bot.createChat(chatID).json({ | |
| message: message, | |
| reply_markup: { | |
| restrict_reated: true | |
| } | |
| }).then((result) => { | |
| console.log('result:', result); | |
| if (result.ok === false; () => { | |
| })) | |
| } else { | |
| // Send message | |
| _bot.sendMessage().json({ | |
| chat_id: chatID, | |
| text: message, | |
| reply_markup: { | |
| restrict_reated: true | |
| } | |
| }).then((result) => { | |
| console.log('result:', result); | |
| if (result.ok === false; () => { | |
| })) | |
| } | |
| }) | |
| } | |
| export default ChatClient; |