Spaces:
Running
Running
File size: 1,255 Bytes
304563a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
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; |