Browse Source

Shorten külboard and message reaction log embed message if it's too long

master
Abheek Dhawan 4 years ago
parent
commit
486aaf2fb1
  1. 44
      bot.js

44
bot.js

@ -865,10 +865,18 @@ client.on('messageReactionAdd', (messageReaction, user) => {
.setTimestamp() .setTimestamp()
.setColor('00aaff'); .setColor('00aaff');
if (message.content) { if (message.content) {
messageReactionAddEmbed.addField("Message", message.content); if (message.content.length > 25) {
messageReactionAddEmbed.addField("Message", message.content.substring(0, 25) + "...")
} else {
messageReactionAddEmbed.addField("Message", message.content);
}
} }
//if (message.content) {
// messageReactionAddEmbed.addField("Message", message.content);
//}
const kulboardEmbed = new Discord.MessageEmbed() const kulboardEmbed = new Discord.MessageEmbed()
.setTitle(`${coolness}`) .setTitle(`${coolness}`)
.addField("Link", `[Click here!](${message.url})`, true) .addField("Link", `[Click here!](${message.url})`, true)
@ -881,7 +889,11 @@ client.on('messageReactionAdd', (messageReaction, user) => {
.setTimestamp(); .setTimestamp();
if (message.content) { if (message.content) {
kulboardEmbed.addField("Message", message.content); if (message.content.length > 1024) {
kulboardEmbed.addField("Message", message.content.substring(0, 1020) + "...")
} else {
kulboardEmbed.addField("Message", message.content);
}
} }
collection.findOne({ guild_id: messageReaction.message.guild.id }, (error, result) => { collection.findOne({ guild_id: messageReaction.message.guild.id }, (error, result) => {
let kulboardChannel; let kulboardChannel;
@ -952,10 +964,18 @@ client.on('messageReactionRemove', (messageReaction, user) => {
.setTimestamp() .setTimestamp()
.setColor('e7778b'); .setColor('e7778b');
if (message.content) { if (message.content) {
messageReactionRemoveEmbed.addField("Message", message.content); if (message.content.length > 25) {
messageReactionRemoveEmbed.addField("Message", message.content.substring(0, 25) + "...")
} else {
messageReactionRemoveEmbed.addField("Message", message.content);
}
} }
//if (message.content) {
// messageReactionRemoveEmbed.addField("Message", message.content);
//}
const kulboardEmbed = new Discord.MessageEmbed() const kulboardEmbed = new Discord.MessageEmbed()
.setTitle(`${coolness}`) .setTitle(`${coolness}`)
.addField("Link", `[Click here!](${message.url})`, true) .addField("Link", `[Click here!](${message.url})`, true)
@ -967,9 +987,17 @@ client.on('messageReactionRemove', (messageReaction, user) => {
.setColor("00c5ff") .setColor("00c5ff")
.setTimestamp(); .setTimestamp();
if (message.content) { if (message.content) {
kulboardEmbed.addField("Message", message.content) if (message.content.length > 1024) {
} kulboardEmbed.addField("Message", message.content.substring(0, 1020) + "...")
} else {
kulboardEmbed.addField("Message", message.content);
}
}
// if (message.content) {
// kulboardEmbed.addField("Message", message.content)
// }
collection.findOne({ guild_id: messageReaction.message.guild.id }, (error, result) => { collection.findOne({ guild_id: messageReaction.message.guild.id }, (error, result) => {
let kulboardChannel; let kulboardChannel;

Loading…
Cancel
Save