Add telegram util to send telegram messages and location

This commit is contained in:
2021-01-01 15:58:02 +05:30
parent ace77028c4
commit b743cbc9a5
4 changed files with 28 additions and 1 deletions

0
src/utils/index.js Normal file
View File

19
src/utils/telegram.js Normal file
View File

@@ -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;