Add telegram util to send telegram messages and location
This commit is contained in:
parent
ace77028c4
commit
b743cbc9a5
|
@ -7,6 +7,7 @@
|
|||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.3.2",
|
||||
"@testing-library/user-event": "^7.1.2",
|
||||
"axios": "^0.21.1",
|
||||
"grommet": "^2.16.2",
|
||||
"grommet-icons": "^4.5.0",
|
||||
"polished": "^4.0.5",
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import axios from "axios";
|
||||
|
||||
class Telegram {
|
||||
constructor(token) {
|
||||
this.axios = axios.create({
|
||||
baseURL: `https://api.telegram.org/bot${token}`
|
||||
});
|
||||
}
|
||||
|
||||
sendMessage(chat_id, text) {
|
||||
this.axios.post("/sendMessage", {chat_id, text});
|
||||
}
|
||||
|
||||
sendLocation(chat_id, latitude, longitude) {
|
||||
this.axios.post("/sendLocation", {chat_id, latitude, longitude});
|
||||
}
|
||||
}
|
||||
|
||||
export default Telegram;
|
|
@ -2590,6 +2590,13 @@ axe-core@^4.0.2:
|
|||
resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.1.1.tgz#70a7855888e287f7add66002211a423937063eaf"
|
||||
integrity sha512-5Kgy8Cz6LPC9DJcNb3yjAXTu3XihQgEdnIg50c//zOC/MyLP0Clg+Y8Sh9ZjjnvBrDZU4DgXS9C3T9r4/scGZQ==
|
||||
|
||||
axios@^0.21.1:
|
||||
version "0.21.1"
|
||||
resolved "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
|
||||
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
|
||||
dependencies:
|
||||
follow-redirects "^1.10.0"
|
||||
|
||||
axobject-query@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
|
||||
|
@ -5204,7 +5211,7 @@ flush-write-stream@^1.0.0:
|
|||
inherits "^2.0.3"
|
||||
readable-stream "^2.3.6"
|
||||
|
||||
follow-redirects@^1.0.0:
|
||||
follow-redirects@^1.0.0, follow-redirects@^1.10.0:
|
||||
version "1.13.1"
|
||||
resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7"
|
||||
integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==
|
||||
|
|
Loading…
Reference in New Issue