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. 30
      bot.js

30
bot.js

@ -866,8 +866,16 @@ client.on('messageReactionAdd', (messageReaction, user) => {
.setColor('00aaff'); .setColor('00aaff');
if (message.content) { if (message.content) {
if (message.content.length > 25) {
messageReactionAddEmbed.addField("Message", message.content.substring(0, 25) + "...")
} else {
messageReactionAddEmbed.addField("Message", message.content); 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}`)
@ -881,8 +889,12 @@ client.on('messageReactionAdd', (messageReaction, user) => {
.setTimestamp(); .setTimestamp();
if (message.content) { if (message.content) {
if (message.content.length > 1024) {
kulboardEmbed.addField("Message", message.content.substring(0, 1020) + "...")
} else {
kulboardEmbed.addField("Message", 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;
let botLogsChannel; let botLogsChannel;
@ -953,8 +965,16 @@ client.on('messageReactionRemove', (messageReaction, user) => {
.setColor('e7778b'); .setColor('e7778b');
if (message.content) { if (message.content) {
if (message.content.length > 25) {
messageReactionRemoveEmbed.addField("Message", message.content.substring(0, 25) + "...")
} else {
messageReactionRemoveEmbed.addField("Message", message.content); 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}`)
@ -968,9 +988,17 @@ client.on('messageReactionRemove', (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);
}
} }
// 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;
let botLogsChannel; let botLogsChannel;

Loading…
Cancel
Save