Pinboard
This commit is contained in:
parent
f3d69a4c4c
commit
3d62322228
|
@ -9,7 +9,8 @@ module.exports = {
|
||||||
"webhooks": {
|
"webhooks": {
|
||||||
"welcome": process.env.WEBHOOK_WELCOME.split("/"),
|
"welcome": process.env.WEBHOOK_WELCOME.split("/"),
|
||||||
"error": process.env.WEBHOOK_ERROR.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",
|
"opID": "281134216115257344",
|
||||||
|
|
|
@ -25,4 +25,8 @@ dClient.on("voiceStateUpdate", async function(oldState, newState){
|
||||||
dClient.on("emojiDelete", async function(emoji){
|
dClient.on("emojiDelete", async function(emoji){
|
||||||
if (emoji.guild.id == config.guildID)
|
if (emoji.guild.id == config.guildID)
|
||||||
this.emit("local_emojiDelete", emoji);
|
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);
|
||||||
});
|
});
|
44
src/misc.js
44
src/misc.js
|
@ -87,6 +87,44 @@
|
||||||
|
|
||||||
|
|
||||||
// persistent emojis
|
// persistent emojis
|
||||||
dClient.on("local_emojiDelete", emoji => {
|
dClient.on("local_emojiDelete", async emoji => {
|
||||||
emoji.guild.emojis.create(emoji.url, emoji.name);
|
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}`
|
||||||
|
}
|
||||||
|
}]});
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue