146 } else {
147 invText = "Available in the Discord developer portal";
148 }
149 let leagueText;150 if (leagueEnabled === false) leagueText = "🚫 League commands will not work"
151 else if (leagueEnabled) leagueText = "✅";
152 else leagueText = "💬 Still trying to start the League API";
25 configFile = { "help-domain": "quotobot.js.org" };
26}
27const authorPictures = require("./db/portraits.js");
28let token; 29if (configFile.token == "your-token-here-inside-these-quotes") {
30 token = envVars.QBTOKEN;
31} else if (!configFile.token) { token = envVars.QBTOKEN; }
15const bot = new Discord.Client();
16require("dotenv").config();
17// config stuff
18let configFile; 19try {
20 configFile = require("./config.json");
21} catch (e) {
41const helpDomain = envVars.QBSTATUS || configFile["help-domain"] || undefined;
42let helpMessage;
43// handle starting up the League API
44let leagueEnabled; 45try {
46 if (!envVars.QBRGKEY && !configFile.riotKey) {
47 throw new Error("The Riot key is falsy (usually undefined). Did you put a key?")
140 db.each(randQuoteQuery).then(
141 ({ quote, source }) => console.log(chalk`{blueBright "${quote}" –${source}}`)
142 )
143 let invText;144 if (configFile.clientID) {
145 invText = `https://discordapp.com/oauth2/authorize?client_id=${configFile.clientID}&scope=bot&permissions=${configFile.permissionValue.toString() || "280576"}`;
146 } else {
In JavaScript, variables can be assigned during declaration, or at any point afterwards using an assignment statement. For example, in the following code, foo
is initialized during declaration, while bar
is initialized later.
var foo = 1;
var bar;
if (foo) {
bar = 1;
} else {
bar = 2;
}
function foo() {
var bar;
let baz;
}
function foo() {
var bar = 1;
let baz = 2;
const qux = 3;
}