From 00dee1e2919fc020c236318880435215890ed38a Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Thu, 1 Apr 2021 13:06:13 -0500 Subject: [PATCH] Download data on addRoles --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b050121..64832ec 100644 --- a/index.js +++ b/index.js @@ -3,13 +3,13 @@ const csv = require('csvtojson'); const Discord = require('discord.js'); const client = new Discord.Client({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] }); - +const { execSync } = require("child_process"); client.on("ready", () => { console.log("Logged in as " + client.user.tag + "!"); }); -client.on("message", message => { +client.on("message", async message => { switch (message.content.toLowerCase()) { case '$score': startScoring(message); @@ -18,6 +18,7 @@ client.on("message", message => { memberCount(message); break; case '$addroles': + execSync("wget --no-check-certificate --output-document=participants.csv https://docs.google.com/spreadsheets/d/1lufn28YR29OkCS4wH_WQXfCalAgJRi8_r4NCesJSbQY/export\?gid\=2119488170\&format\=csv", { encoding: 'utf-8' }); csv().fromFile('participants.csv') .then(users => { users.forEach(function (user) {