From e191702914bb4387a2df0585ffed1fa9dcad0ef9 Mon Sep 17 00:00:00 2001 From: Hirzi <64255651+HirziDevs@users.noreply.github.com> Date: Tue, 13 Jul 2021 12:14:38 +0700 Subject: [PATCH] v1.1.8 --- index.js | 61 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/index.js b/index.js index 20c93ed..fa6a81d 100644 --- a/index.js +++ b/index.js @@ -1,37 +1,38 @@ -const { Client, Collection } = require('discord.js'); -const { MessageEmbed } = require('discord.js') -const fs = require('fs'); -const client = new Client(); -const config = require('./config.json'); +const { Client, Collection, MessageEmbed } = require('discord.js') +const fs = require('fs') +const client = new Client() +const yaml = require("js-yaml") +const config = yaml.load(fs.readFileSync('./test.yml', 'utf8')) +client.config = config let nodelist = [ -{ - id: "Server ID", - name: "**Example Server 1**", - nameid: "Node1" -}, -{ - id: "Server ID", - name: "**Example Server 2**", - nameid: "Node2" -}, -//Add more code like bellow to the nodeslist array after comma and before "]" if you want to add more nodes -//{ -// id: "Server ID", -// name: "**Example Server 3**", -// nameid: "Node3" -//}, + { + id: "Server ID", + name: "Example Server 1", + nameid: "Node1" + }, + { + id: "Server ID", + name: "Example Server 2", + nameid: "Node2" + }, + //Add more code like bellow to the nodeslist array after comma and before "]" if you want to add more nodes + //{ + // id: "Server ID", + // name: "Example Server 3", + // nameid: "Node3" + //}, ] client.nodelist = nodelist fs.readdir('./events/', (err, files) => { - if (err) return console.error(err); - files.forEach(file => { - const event = require(`./events/${file}`); - const eventName = file.split('.')[0]; - client.on(eventName, event.bind(null, client)); - }); -}); + if (err) return console.error(err) + files.forEach(file => { + const event = require(`./events/${file}`) + const eventName = file.split('.')[0] + client.on(eventName, event.bind(null, client)) + }) +}) -if(config.token === "BOT TOKEN") console.log(chalk.blue("[PteroStats Checker] ") + chalk.red("Invalid Token, Check ") + chalk.green("config.json") + chalk.red(" file to change token")) -client.login(config.token); +if (config.token === "BOT TOKEN") console.log(chalk.blue("[PteroStats Checker] ") + chalk.red("Invalid Token, Check ") + chalk.green("config.json") + chalk.red(" file to change token")) +client.login(config.token)