From ed2945f722ce8b7160e904c5196de4dfe68c71de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Wed, 26 Jun 2019 03:51:34 +0200 Subject: [PATCH] allow non nsfw board to be displayed on non nsfw channel and put full name of board --- commands/fun/4chan.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/fun/4chan.js b/commands/fun/4chan.js index d2d7537b..579ba27a 100644 --- a/commands/fun/4chan.js +++ b/commands/fun/4chan.js @@ -1,6 +1,7 @@ const { Command } = require('discord-akairo'); const { MessageEmbed } = require('discord.js'); const fetch = require('node-fetch'); +const boards = require('4chan-boards'); class FourchanCommand extends Command { constructor() { @@ -27,7 +28,7 @@ class FourchanCommand extends Command { } async exec(message, args) { - if (!message.channel.nsfw) return message.channel.send('Sorry, this command only work in nsfw channel!'); + if (boards.getType(args.board) === boards.NSFW && !message.channel.nsfw) return message.channel.send('Sorry, this board only work in nsfw channel!'); if (!args.board) return; @@ -48,7 +49,7 @@ class FourchanCommand extends Command { .setDescription(description) .setImage(`https://i.4cdn.org/${args.board}/${response.threads[i].posts[0].tim}${response.threads[i].posts[0].ext}`) .setURL(`https://boards.4chan.org/${args.board}/thread/${response.threads[i].posts[0].no}/${response.threads[i].posts[0].semantic_url}`) - .setFooter(`${args.board} | ${response.threads[i].posts[0].now}`) + .setFooter(`${boards.getName(args.board)} | ${response.threads[i].posts[0].now}`) .setTimestamp(); message.channel.send(FourchanEmbed);