Skip to content

Commit

Permalink
Updated node fetch and fixed alert
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-NCSU committed Jan 22, 2022
1 parent 05d94a1 commit ed3920f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Queue = require('queue-promise');
const limiter = new Limit(95);
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const fetch = require('node-fetch');
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
const { MongoClient } = require("mongodb");
var cron = require('node-cron');
require('dotenv').config();
Expand Down
6 changes: 3 additions & 3 deletions messagecommands/banlist.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
const token = require('../index.js');

/**
Expand Down Expand Up @@ -72,12 +72,12 @@ async function list(message) {
const cursor = token.db.db('banned_runners').collection('mc').find();
let results = await cursor.toArray();
await token.db.close();
let str = '';
let str = '```';
for(const player of results) {
const player2 = await fetch(`https://api.mojang.com/user/profiles/${player.id}/names`).then(response => response.json()).catch( reason => {});
str += 'IGN: ' + player2[player2.length - 1].name + '\n';
}
return await message.reply(str.replace(/[*_~]/g, "\\$&"));
return await message.reply(str + '```');
}

async function search(id, message) {
Expand Down
2 changes: 1 addition & 1 deletion messagecommands/check.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fetch = require('node-fetch');
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
const token = require('../index.js');

/**
Expand Down

0 comments on commit ed3920f

Please sign in to comment.