allow non nsfw board to be displayed on non nsfw channel and put full name of board
This commit is contained in:
parent
3abd3731ad
commit
ed2945f722
1 changed files with 3 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
const { Command } = require('discord-akairo');
|
const { Command } = require('discord-akairo');
|
||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
|
const boards = require('4chan-boards');
|
||||||
|
|
||||||
class FourchanCommand extends Command {
|
class FourchanCommand extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -27,7 +28,7 @@ class FourchanCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(message, args) {
|
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;
|
if (!args.board) return;
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ class FourchanCommand extends Command {
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
.setImage(`https://i.4cdn.org/${args.board}/${response.threads[i].posts[0].tim}${response.threads[i].posts[0].ext}`)
|
.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}`)
|
.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();
|
.setTimestamp();
|
||||||
|
|
||||||
message.channel.send(FourchanEmbed);
|
message.channel.send(FourchanEmbed);
|
||||||
|
|
Loading…
Reference in a new issue