forked from Supositware/Haha-Yes
dosen't throw error
This commit is contained in:
parent
68131500f4
commit
b194b8011c
2 changed files with 23 additions and 7 deletions
|
@ -29,7 +29,6 @@ class StarBoardCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(message, args) {
|
async exec(message, args) {
|
||||||
console.log(args);
|
|
||||||
let starboardChannel = message.channel.id;
|
let starboardChannel = message.channel.id;
|
||||||
|
|
||||||
fs.writeFile(`./board/star${message.guild.id}.json`, `{"starboard": "${starboardChannel}", "emote": "${args.emote}", "count": "${args.count}"}`, function (err) {
|
fs.writeFile(`./board/star${message.guild.id}.json`, `{"starboard": "${starboardChannel}", "emote": "${args.emote}", "count": "${args.count}"}`, function (err) {
|
||||||
|
|
|
@ -14,10 +14,20 @@ class MessageReactionAddListener extends Listener {
|
||||||
async exec(reaction) {
|
async exec(reaction) {
|
||||||
let messageContent = reaction.message.content;
|
let messageContent = reaction.message.content;
|
||||||
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
||||||
let starboardChannel = reload(`../../board/star${reaction.message.guild.id}.json`);
|
|
||||||
|
|
||||||
let staremote = starboardChannel['emote'];
|
let starboardChannel;
|
||||||
let starcount = starboardChannel['count'];
|
let staremote;
|
||||||
|
let starcount;
|
||||||
|
|
||||||
|
try {
|
||||||
|
starboardChannel = reload(`../../board/star${reaction.message.guild.id}.json`);
|
||||||
|
|
||||||
|
staremote = starboardChannel['emote'];
|
||||||
|
starcount = starboardChannel['count'];
|
||||||
|
} catch (err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Starboard
|
// Starboard
|
||||||
if (reaction.emoji.name == staremote && reaction.count == starcount) {
|
if (reaction.emoji.name == staremote && reaction.count == starcount) {
|
||||||
|
@ -41,11 +51,18 @@ class MessageReactionAddListener extends Listener {
|
||||||
return channel.send(`in: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`);
|
return channel.send(`in: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let shameboardChannel;
|
||||||
|
let shameemote;
|
||||||
|
let shamecount;
|
||||||
|
try {
|
||||||
|
shameboardChannel = reload(`../../board/shame${reaction.message.guild.id}.json`);
|
||||||
|
|
||||||
let shameboardChannel = reload(`../../board/shame${reaction.message.guild.id}.json`);
|
shameemote = shameboardChannel['emote'];
|
||||||
|
shamecount = shameboardChannel['count'];
|
||||||
|
} catch (err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let shameemote = shameboardChannel['emote'];
|
|
||||||
let shamecount = shameboardChannel['count'];
|
|
||||||
|
|
||||||
|
|
||||||
//Shameboard
|
//Shameboard
|
||||||
|
|
Loading…
Reference in a new issue