teacaptainx 1.0.1 → 1.1.0
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 +42 -0
- package/package.json +12 -3
package/.env
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
CRYPTOCOMPARE_API_KEY=461b81123ad34a9104310e92dd0dec94adb0b3a468e0fe276adfb4364aa51a0b
|
package/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
web: node index.js
|
package/index.js
ADDED
@@ -0,0 +1,42 @@
|
|
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
|
+
|
22
|
+
║ 🟣 Ethereum: $${prices.ethereum.usd}
|
23
|
+
|
24
|
+
║ 🟢 Solana: $${prices.solana.usd}
|
25
|
+
|
26
|
+
║ 🔵 Binance Coin: $${prices.binancecoin.usd}
|
27
|
+
|
28
|
+
║ 🟡 Dogecoin: $${prices.dogecoin.usd}
|
29
|
+
╚════════════════════════════════════════╝
|
30
|
+
`;
|
31
|
+
|
32
|
+
bot.sendMessage(chatId, message);
|
33
|
+
} catch (error) {
|
34
|
+
console.error('Error fetching and sending crypto prices:', error.message);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
// Fetch and send prices initially
|
39
|
+
sendCryptoPrices();
|
40
|
+
|
41
|
+
// Fetch and send prices every 10 seconds
|
42
|
+
setInterval(sendCryptoPrices, 3000000);
|
package/package.json
CHANGED
@@ -1,19 +1,28 @@
|
|
1
1
|
{
|
2
2
|
"name": "teacaptainx",
|
3
|
-
"version": "1.0
|
3
|
+
"version": "1.1.0",
|
4
4
|
"description": "teaOSSProject",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
7
|
+
"start": "node index.js",
|
7
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
8
9
|
},
|
9
10
|
"repository": {
|
10
11
|
"type": "git",
|
11
12
|
"url": "git+https://github.com/mrriad009/teacaptainx.git"
|
12
13
|
},
|
13
|
-
"author": "",
|
14
|
+
"author": "captainbnb",
|
14
15
|
"license": "ISC",
|
15
16
|
"bugs": {
|
16
17
|
"url": "https://github.com/mrriad009/teacaptainx/issues"
|
17
18
|
},
|
18
|
-
"homepage": "https://github.com/mrriad009/teacaptainx#readme"
|
19
|
+
"homepage": "https://github.com/mrriad009/teacaptainx#readme",
|
20
|
+
"keywords": [],
|
21
|
+
"dependencies": {
|
22
|
+
"axios": "^1.7.2",
|
23
|
+
"ccxt": "^4.3.30",
|
24
|
+
"dotenv": "^16.4.5",
|
25
|
+
"node-telegram-bot-api": "^0.66.0"
|
26
|
+
},
|
27
|
+
"devDependencies": {}
|
19
28
|
}
|