├── Procfile ├── package.json └── index.js /Procfile: -------------------------------------------------------------------------------- 1 | worker: node index.js 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "viloidPricebot", 3 | "version": "1.0.0", 4 | "description": "Just simple bot", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node index.js" 8 | }, 9 | "keywords": [ 10 | "discord", 11 | "bot" 12 | ], 13 | "author": "github.com/vsec7", 14 | "license": "ISC", 15 | "dependencies": { 16 | "discord.js": "^12.5.3", 17 | "node-fetch": "^2.6.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import fetch from "node-fetch"; 2 | import Discord from "discord.js"; 3 | 4 | const client = new Discord.Client(); 5 | client.login("Token Discord Bot"); 6 | 7 | async function getPrice() { 8 | const g = await fetch("https://api.pancakeswap.info/api/v2/tokens/0x5b5a3a45002736413613b8a4c46cc0d9d1d6f4ae"); 9 | const hasil = await g.json(); 10 | const perusd = parseFloat(hasil.data.price).toFixed(15) 11 | //const perBnb = parseFloat(hasil.data.price_BNB).toFixed(15) 12 | return perusd 13 | } 14 | 15 | async function main() { 16 | client.user 17 | .setActivity(`$ ${await getPrice()}`, { type: "WATCHING" }) 18 | .then((presence) => 19 | console.log(`Activity set to ${presence.activities[0].name}`) 20 | ) 21 | .catch((err) => console.log(err)); 22 | } 23 | 24 | setInterval(() => main(), 30000); 25 | --------------------------------------------------------------------------------