diff --git a/index.js b/index.js index 0b599dd..9ba9b5a 100644 --- a/index.js +++ b/index.js @@ -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(); diff --git a/messagecommands/banlist.js b/messagecommands/banlist.js index 0c803bb..059a4d1 100644 --- a/messagecommands/banlist.js +++ b/messagecommands/banlist.js @@ -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'); /** @@ -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) { diff --git a/messagecommands/check.js b/messagecommands/check.js index a1872ff..765bbeb 100644 --- a/messagecommands/check.js +++ b/messagecommands/check.js @@ -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'); /**