This commit is contained in:
Lamp 2018-12-13 06:12:24 +00:00
parent f3d69a4c4c
commit 3d62322228
3 changed files with 47 additions and 4 deletions

View File

@ -9,7 +9,8 @@ module.exports = {
"webhooks": {
"welcome": process.env.WEBHOOK_WELCOME.split("/"),
"error": process.env.WEBHOOK_ERROR.split("/"),
"ddp": process.env.WEBHOOK_DDP.split("/")
"ddp": process.env.WEBHOOK_DDP.split("/"),
"pinboard": process.env.WEBHOOK_PINBOARD.split("/")
},
"opID": "281134216115257344",

View File

@ -25,4 +25,8 @@ dClient.on("voiceStateUpdate", async function(oldState, newState){
dClient.on("emojiDelete", async function(emoji){
if (emoji.guild.id == config.guildID)
this.emit("local_emojiDelete", emoji);
});
dClient.on("messageReactionAdd", async function(messageReaction, user){
if (messageReaction.message.guild.id == config.guildID)
this.emit("local_messageReactionAdd", messageReaction, user);
});

View File

@ -87,6 +87,44 @@
// persistent emojis
dClient.on("local_emojiDelete", emoji => {
emoji.guild.emojis.create(emoji.url, emoji.name);
});
dClient.on("local_emojiDelete", async emoji => {
await emoji.guild.emojis.create(emoji.url, emoji.name);
});
// pinboard
(async function(){
var webhook = new Discord.WebhookClient(config.webhooks.pinboard[0], config.webhooks.pinboard[1]);
dClient.on("local_messageReactionAdd", async (messageReaction, user) => {
if (!(messageReaction.emoji.name == "📌" || messageReaction.emoji.name == "📍")) return;
if (!(user.id == messageReaction.message.author.id || messageReaction.message.guild.members.get(user.id).hasPermission('MANAGE_MESSAGES'))) return;// if message is theirs or user is mod
var message = messageReaction.message;
await webhook.send(`https://discordapp.com/channels/${message.guild.id}${message.channel.id}/${message.id}`, {embeds:[{
color: (message.member && message.member.displayColor) || undefined,
author: {
name: (message.member && message.member.displayName) || message.author.username,
icon_url: message.author.avatarURL({format:'png'})
},
description: message.content,
timestamp: message.createdAt,
image: (message.attachments.first() && message.attachments.first().width) ? {url:message.attachments.first().url} : undefined,
footer: {
text: `#${message.channel.name}`
}
}]});
});
})();