@azteam/telegram-api
Advanced tools
Comparing version 1.0.63 to 1.0.64
{ | ||
"name": "@azteam/telegram-api", | ||
"version": "1.0.63", | ||
"version": "1.0.64", | ||
"description": "", | ||
@@ -17,6 +17,2 @@ "main": "src/index.js", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/toda93/telegram-api/issues" | ||
}, | ||
"homepage": "https://github.com/toda93/telegram-api#readme", | ||
"dependencies": { | ||
@@ -23,0 +19,0 @@ "@azteam/http-client": "1.0.75" |
@@ -1,6 +0,4 @@ | ||
import TelegramAPI from './TelegramAPI'; | ||
export default from './TelegramAPI'; | ||
export * from './constant'; | ||
export { | ||
TelegramAPI, | ||
} |
import HttpClient from '@azteam/http-client'; | ||
import { CALLBACK_TYPE } from './constant'; | ||
class TelegramAPI { | ||
@@ -42,3 +44,3 @@ constructor(token) { | ||
async sendReply(id, message, menu, isRemoveKeyBoard = true) { | ||
async sendReply(id, message, menu) { | ||
@@ -51,8 +53,36 @@ return this.client.post(this.endpoint + '/sendMessage', { | ||
resize_keyboard: true, | ||
remove_keyboard: isRemoveKeyBoard | ||
}) | ||
}); | ||
} | ||
static parseCallback(data) { | ||
if (data.callback_query) { | ||
const { from } = data.callback_query; | ||
return { | ||
callbackType: CALLBACK_TYPE.CALLBACK | ||
userID: from.id | ||
} | ||
} | ||
const { from, text, entities } = data.message; | ||
if (entities) { | ||
if (entity.type === 'bot_command') { | ||
return { | ||
callbackType: CALLBACK_TYPE.COMMAND | ||
userID: from.id, | ||
text: parseText | ||
} | ||
} else { | ||
console.info(entity); | ||
} | ||
} | ||
return { | ||
callbackType: CALLBACK_TYPE.TEXT | ||
userID: from.id, | ||
text, | ||
} | ||
} | ||
} | ||
export default TelegramAPI; | ||
export default TelegramAPI; |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
2834
5
78