teacaptainx 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.devcontainer/devcontainer.json +6 -0
- package/.env +1 -0
- package/Procfile +1 -0
- package/index.js +38 -0
- package/package.json +10 -2
package/.env
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
CRYPTOCOMPARE_API_KEY=461b81123ad34a9104310e92dd0dec94adb0b3a468e0fe276adfb4364aa51a0b
|
package/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
worker: node index.js
|
package/index.js
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
const axios = require('axios');
|
2
|
+
const TelegramBot = require('node-telegram-bot-api');
|
3
|
+
|
4
|
+
// Replace 'YOUR_BOT_TOKEN' with your bot's token
|
5
|
+
const bot = new TelegramBot('7112433814:AAGE1G5-FgsFofJ3UtwkB8C9yjX3WW-4bmE', { polling: false });
|
6
|
+
|
7
|
+
// Replace 'YOUR_CHAT_ID' with your chat ID obtained from the getUpdates method
|
8
|
+
const chatId = '-1002153693812';
|
9
|
+
|
10
|
+
// Function to fetch and send crypto prices to a specific chat ID
|
11
|
+
async function sendCryptoPrices() {
|
12
|
+
try {
|
13
|
+
const response = await axios.get('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,solana,binancecoin,dogecoin,inj&vs_currencies=usd');
|
14
|
+
const prices = response.data;
|
15
|
+
|
16
|
+
const message = `
|
17
|
+
╔═════════════════════════════════════════════════╗
|
18
|
+
║ Crypto Prices ║╝
|
19
|
+
╠═════════════════════════════════════════════════╣╝
|
20
|
+
║ 🟠 Bitcoin: $${prices.bitcoin.usd} ║
|
21
|
+
║ 🟣 Ethereum: $${prices.ethereum.usd} ║
|
22
|
+
║ 🟢 Solana: $${prices.solana.usd} ║
|
23
|
+
║ 🔵 Binance Coin: $${prices.binancecoin.usd} ║
|
24
|
+
║ 🟡 Dogecoin: $${prices.dogecoin.usd} ║
|
25
|
+
╚═════════════════════════════════════════════════╝╝
|
26
|
+
`;
|
27
|
+
|
28
|
+
bot.sendMessage(chatId, message);
|
29
|
+
} catch (error) {
|
30
|
+
console.error('Error fetching and sending crypto prices:', error.message);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
// Fetch and send prices initially
|
35
|
+
sendCryptoPrices();
|
36
|
+
|
37
|
+
// Fetch and send prices every 10 seconds
|
38
|
+
setInterval(sendCryptoPrices, 3000000);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "teacaptainx",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
4
4
|
"description": "teaOSSProject",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -15,5 +15,13 @@
|
|
15
15
|
"bugs": {
|
16
16
|
"url": "https://github.com/mrriad009/teacaptainx/issues"
|
17
17
|
},
|
18
|
-
"homepage": "https://github.com/mrriad009/teacaptainx#readme"
|
18
|
+
"homepage": "https://github.com/mrriad009/teacaptainx#readme",
|
19
|
+
"keywords": [],
|
20
|
+
"dependencies": {
|
21
|
+
"axios": "^1.7.2",
|
22
|
+
"ccxt": "^4.3.30",
|
23
|
+
"dotenv": "^16.4.5",
|
24
|
+
"node-telegram-bot-api": "^0.66.0"
|
25
|
+
},
|
26
|
+
"devDependencies": {}
|
19
27
|
}
|