telenode-js
Advanced tools
Comparing version 1.4.2 to 1.5.0
{ | ||
"name": "telenode-js", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"description": "Lightweight Telegram API framework for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,5 +28,9 @@ # Telenode | ||
✅ Long polling support | ||
<br> | ||
✅ Sending chat action | ||
## Getting started | ||
#### Complete example can be found [here](https://github.com/NivEz/movie-info-bot) | ||
### Installation | ||
@@ -33,0 +37,0 @@ |
@@ -8,2 +8,15 @@ const { runServer } = require('./server'); | ||
#secretToken; | ||
validChatActions = [ | ||
'typing', | ||
'upload_photo', | ||
'record_video', | ||
'upload_video', | ||
'record_voice', | ||
'upload_voice', | ||
'upload_document', | ||
'choose_sticker', | ||
'find_location', | ||
'record_video_note', | ||
'upload_video_note', | ||
]; | ||
@@ -190,4 +203,19 @@ constructor({ apiToken, secretToken }) { | ||
} | ||
async sendChatAction(chatId, chatAction) { | ||
if (!this.validChatActions.includes(chatAction)) { | ||
throw new Error( | ||
`Invalid chat action. Valid chat action should be one of: ${this.validChatActions.join( | ||
', ', | ||
)}`, | ||
); | ||
} | ||
const url = this.#baseUrl + '/sendChatAction'; | ||
await axios.post(url, { | ||
chat_id: chatId, | ||
action: chatAction, | ||
}); | ||
} | ||
} | ||
module.exports = Telenode; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23830
18
566
214
19