mirror of
https://gitlab.com/sarlink/kyc.git
synced 2025-02-22 17:32:03 +00:00
[fix] Removed old testing code for telegram
This commit is contained in:
parent
01b1736857
commit
1019bb6f7a
27
test.js
27
test.js
@ -1,27 +0,0 @@
|
||||
require("dotenv").config()
|
||||
const FormData = require('form-data');
|
||||
const axios = require('axios').default;
|
||||
const fs = require("fs")
|
||||
|
||||
const file = "./src/public/sarlink.jpg";
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append("photo", fs.createReadStream(file));
|
||||
formData.append("message", "Sarlink test image");
|
||||
|
||||
const query = new URLSearchParams();
|
||||
query.append("chat_id", process.env.TELEGRAM_CHAT_ID);
|
||||
query.append("caption", "Sarlink test image");
|
||||
|
||||
// upload file to telegram using axios
|
||||
axios.post(`${process.env.TG_BOTAPI}${process.env.TELEGRAM_BOT_TOKEN}/sendPhoto?${query.toString()}`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
console.log(response.data)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user