Sunday 31 March 2019

How do I print this value?

This is my code. I want to print the value broadcasted on "console.log(info) (the console.log prints the correct number i wanted) but in the bottom IF statement. But everytime I run the program it says message is not defined.const Discord = require('discord.js');const { prefix,token } = require('./config.json');const client = new Discord.Client();//CoinGecko API Grabbingconst CoinGecko = require('coingecko-api');const CoinGeckoClient = new CoinGecko();let hello = `how are you`;//Grabbing API Responcevar pingGecko = async() => {let information = await CoinGeckoClient.simple.price({ids: ['bitcoin'],vs_currencies: ['cad']});global.info = (information.data.bitcoin.cad)console.log(info)const Discord = require('discord.js');const { prefix,token } = require('./config.json');const client = new Discord.Client();//CoinGecko API Grabbingconst CoinGecko = require('coingecko-api');const CoinGeckoClient = new CoinGecko();let hello = `how are you`;//Grabbing API Responcevar pingGecko = async() => {let information = await CoinGeckoClient.simple.price({ids: ['bitcoin'],vs_currencies: ['cad']});global.info = (information.data.bitcoin.cad)console.log(info)if(message.content.startsWith(`${prefix}test`)){message.channel.send(info);}}pingGecko()}}pingGecko()

Submitted April 01, 2019 at 12:23AM by rotaryfurball

No comments:

Post a Comment