|
|
|
@ -5,8 +5,8 @@ const handler = {}; |
|
|
|
|
let ClientID = null, |
|
|
|
|
Guild = null; |
|
|
|
|
|
|
|
|
|
let addTextChannel = (textChannel, title, body) => { |
|
|
|
|
handler[textChannel] = { title, body }; |
|
|
|
|
let addTextChannel = (textChannel, title, body, color) => { |
|
|
|
|
handler[textChannel] = { title, body, color }; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let add = (channel, title, body, color) => { |
|
|
|
@ -23,7 +23,7 @@ let add = (channel, title, body, color) => { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let sendMessage = channel => { |
|
|
|
|
let embed = new Discord.RichEmbed({ |
|
|
|
|
Guild.channels.get(channel).send(new Discord.RichEmbed({ |
|
|
|
|
title: handler[channel]['title'], |
|
|
|
|
fields: [ |
|
|
|
|
{ |
|
|
|
@ -31,11 +31,7 @@ let sendMessage = channel => { |
|
|
|
|
value: handler[channel]['body'] |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}); |
|
|
|
|
if(handler[channel]['color']){ |
|
|
|
|
embed.setColor(handler[channel]['color']); |
|
|
|
|
} |
|
|
|
|
Guild.channels.get(channel).send(embed); |
|
|
|
|
}).setColor(handler[channel]['color'])); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let deleteLastMessage = (channel, callback) => { |
|
|
|
@ -52,9 +48,9 @@ module.exports = { |
|
|
|
|
Guild = guild; |
|
|
|
|
messages.forEach(item => { |
|
|
|
|
if(item['channels']) return item['channels'].forEach(channel => { |
|
|
|
|
add(channel, item['title'], item['body'], item['color'] || 'DEFAULT'); |
|
|
|
|
add(channel, item['title'], item['body'], item['color'] || '#FFFFFF'); |
|
|
|
|
}); |
|
|
|
|
add(item['channel'], item['title'], item['body'], item['color'] || 'DEFAULT'); |
|
|
|
|
add(item['channel'], item['title'], item['body'], item['color'] || '#FFFFFF'); |
|
|
|
|
}); |
|
|
|
|
Object.keys(handler).forEach(channel => deleteLastMessage(Guild.channels.get(channel), () => sendMessage(channel))); |
|
|
|
|
}, |
|
|
|
|