Skip to content

Commit

Permalink
updated all > 1024 length checks to > 1018
Browse files Browse the repository at this point in the history
  • Loading branch information
sabattle committed Aug 27, 2020
1 parent 62d513b commit eb2a4df
Show file tree
Hide file tree
Showing 29 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/commands/admin/setcrownchannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = class SetCrownChannelCommand extends Command {

// Trim message
if (crownMessage) {
if (crownMessage.length >= 1018) crownMessage = crownMessage.slice(0, 1015) + '...';
if (crownMessage.length > 1018) crownMessage = crownMessage.slice(0, 1015) + '...';
crownMessage = `\`\`\`${crownMessage}\`\`\``;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setcrownmessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = class SetCrownMessageCommand extends Command {

let crownMessage = message.content.slice(message.content.indexOf(args[0]), message.content.length);
message.client.db.settings.updateCrownMessage.run(crownMessage, message.guild.id);
if (crownMessage.length >= 1018) crownMessage = crownMessage.slice(0, 1015) + '...';
if (crownMessage.length > 1018) crownMessage = crownMessage.slice(0, 1015) + '...';
message.channel.send(embed.addField('Message', `\`\`\`${crownMessage}\`\`\``)
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setcrownrole.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = class SetCrownRoleCommand extends Command {

// Trim message
if (crownMessage) {
if (crownMessage.length >= 1018) crownMessage = crownMessage.slice(0, 1015) + '...';
if (crownMessage.length > 1018) crownMessage = crownMessage.slice(0, 1015) + '...';
crownMessage = `\`\`\`${crownMessage}\`\`\``;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setcrownschedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = class SetCrownScheduleCommand extends Command {

// Trim message
if (crownMessage) {
if (crownMessage.length >= 1018) crownMessage = crownMessage.slice(0, 1015) + '...';
if (crownMessage.length > 1018) crownMessage = crownMessage.slice(0, 1015) + '...';
crownMessage = `\`\`\`${crownMessage}\`\`\``;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setleavechannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = class SetLeaveChannelCommand extends Command {

// Trim message
if (leaveMessage) {
if (leaveMessage.length >= 1018) leaveMessage = leaveMessage.slice(0, 1015) + '...';
if (leaveMessage.length > 1018) leaveMessage = leaveMessage.slice(0, 1015) + '...';
leaveMessage = `\`\`\`${leaveMessage}\`\`\``;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setleavemessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = class SetLeaveMessageCommand extends Command {

let leaveMessage = message.content.slice(message.content.indexOf(args[0]), message.content.length);
message.client.db.settings.updateLeaveMessage.run(leaveMessage, message.guild.id);
if (leaveMessage.length >= 1018) leaveMessage = leaveMessage.slice(0, 1015) + '...';
if (leaveMessage.length > 1018) leaveMessage = leaveMessage.slice(0, 1015) + '...';

// Update status
const status = message.client.utils.getStatus(leaveChannel, leaveMessage);
Expand Down
8 changes: 4 additions & 4 deletions src/commands/admin/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module.exports = class SettingsCommand extends Command {
.addField('Role', verificationRole, true)
.addField('Channel', verificationChannel, true)
.addField('Status', verificationStatus, true);
if (verificationMessage.length > 1024) embed
if (verificationMessage.length > 1018) embed
.setDescription(verificationMessage)
.addField('Message', 'Message located above due to character limits.');
else embed.addField('Message', verificationMessage);
Expand All @@ -101,7 +101,7 @@ module.exports = class SettingsCommand extends Command {
.setTitle('Settings: `Welcome Messages`')
.addField('Channel', welcomeChannel, true)
.addField('Status', welcomeStatus, true);
if (welcomeMessage.length > 1024) embed
if (welcomeMessage.length > 1018) embed
.setDescription(welcomeMessage)
.addField('Message', 'Message located above due to character limits.');
else embed.addField('Message', welcomeMessage);
Expand All @@ -113,7 +113,7 @@ module.exports = class SettingsCommand extends Command {
.setTitle('Settings: `Leave Messages`')
.addField('Channel', leaveChannel, true)
.addField('Status', leaveStatus, true);
if (leaveMessage.length > 1024) embed
if (leaveMessage.length > 1018) embed
.setDescription(leaveMessage)
.addField('Message', 'Message located above due to character limits.');
else embed.addField('Message', leaveMessage);
Expand All @@ -136,7 +136,7 @@ module.exports = class SettingsCommand extends Command {
.addField('Channel', crownChannel, true)
.addField('Schedule', crownSchedule, true)
.addField('Status', crownStatus);
if (crownMessage.length > 1024) embed
if (crownMessage.length > 1018) embed
.setDescription(crownMessage)
.addField('Message', 'Message located above due to character limits.');
else embed.addField('Message', crownMessage);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setverificationchannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = class SetVerificationChannelCommand extends Command {

// Trim message
if (verificationMessage) {
if (verificationMessage.length >= 1018) verificationMessage = verificationMessage.slice(0, 1015) + '...';
if (verificationMessage.length > 1018) verificationMessage = verificationMessage.slice(0, 1015) + '...';
verificationMessage = `\`\`\`${verificationMessage}\`\`\``;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setverificationmessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = class SetVerificationMessageCommand extends Command {

let verificationMessage = message.content.slice(message.content.indexOf(args[0]), message.content.length);
message.client.db.settings.updateVerificationMessage.run(verificationMessage, message.guild.id);
if (verificationMessage.length >= 1018) verificationMessage = verificationMessage.slice(0, 1015) + '...';
if (verificationMessage.length > 1018) verificationMessage = verificationMessage.slice(0, 1015) + '...';

// Update status
const status = message.client.utils.getStatus(verificationRole && verificationChannel && verificationMessage);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setverificationrole.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = class SetVerificationRoleCommand extends Command {

// Trim message
if (verificationMessage) {
if (verificationMessage.length >= 1018) verificationMessage = verificationMessage.slice(0, 1015) + '...';
if (verificationMessage.length > 1018) verificationMessage = verificationMessage.slice(0, 1015) + '...';
verificationMessage = `\`\`\`${verificationMessage}\`\`\``;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setwelcomechannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = class SetWelcomeChannelCommand extends Command {

// Trim message
if (welcomeMessage) {
if (welcomeMessage.length >= 1018) welcomeMessage = welcomeMessage.slice(0, 1015) + '...';
if (welcomeMessage.length > 1018) welcomeMessage = welcomeMessage.slice(0, 1015) + '...';
welcomeMessage = `\`\`\`${welcomeMessage}\`\`\``;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/setwelcomemessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = class SetWelcomeMessageCommand extends Command {

let welcomeMessage = message.content.slice(message.content.indexOf(args[0]), message.content.length);
message.client.db.settings.updateWelcomeMessage.run(welcomeMessage, message.guild.id);
if (welcomeMessage.length >= 1018) welcomeMessage = welcomeMessage.slice(0, 1015) + '...';
if (welcomeMessage.length > 1018) welcomeMessage = welcomeMessage.slice(0, 1015) + '...';

// Update status
const status = message.client.utils.getStatus(welcomeChannel, welcomeMessage);
Expand Down
6 changes: 3 additions & 3 deletions src/commands/misc/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = class FeedbackCommand extends Command {
const feedbackEmbed = new MessageEmbed()
.setTitle('Feedback')
.setThumbnail(feedbackChannel.guild.iconURL({ dynamic: true }))
.setDescription(feedback)
.setDescription(`\`\`\`${feedback}\`\`\``)
.addField('User', message.member, true)
.addField('Server', message.guild.name, true)
.setFooter(message.member.displayName, message.author.displayAvatarURL({ dynamic: true }))
Expand All @@ -33,7 +33,7 @@ module.exports = class FeedbackCommand extends Command {
feedbackChannel.send(feedbackEmbed);

// Send response
if (feedback.length > 1024) feedback = feedback.slice(0, 1021) + '...';
if (feedback.length > 1018) feedback = feedback.slice(0, 1021) + '...';
const embed = new MessageEmbed()
.setTitle('Feedback')
.setThumbnail('https://raw.githubusercontent.com/sabattle/CalypsoBot/develop/data/images/Calypso.png')
Expand All @@ -42,7 +42,7 @@ module.exports = class FeedbackCommand extends Command {
Please join the [Calypso Support Server](https://discord.gg/pnYVdut) to further discuss your feedback.
`)
.addField('Member', message.member, true)
.addField('Message', feedback)
.addField('Message', `\`\`\`${feedback}\`\`\``)
.setFooter(message.member.displayName, message.author.displayAvatarURL({ dynamic: true }))
.setTimestamp()
.setColor(message.guild.me.displayHexColor);
Expand Down
6 changes: 3 additions & 3 deletions src/commands/misc/reportbug.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = class ReportBugCommand extends Command {
const reportEmbed = new MessageEmbed()
.setTitle('Bug Report')
.setThumbnail(reportChannel.guild.iconURL({ dynamic: true }))
.setDescription(report)
.setDescription(`\`\`\`${report}\`\`\``)
.addField('User', message.member, true)
.addField('Server', message.guild.name, true)
.setFooter(message.member.displayName, message.author.displayAvatarURL({ dynamic: true }))
Expand All @@ -36,7 +36,7 @@ module.exports = class ReportBugCommand extends Command {
reportChannel.send(reportEmbed);

// Send response
if (report.length > 1024) report = report.slice(0, 1021) + '...';
if (report.length > 1018) report = report.slice(0, 1015) + '...';
const embed = new MessageEmbed()
.setTitle('Bug Report')
.setThumbnail('https://raw.githubusercontent.com/sabattle/CalypsoBot/develop/data/images/Calypso.png')
Expand All @@ -46,7 +46,7 @@ module.exports = class ReportBugCommand extends Command {
Additionally, feel free to submit an issue on [GitHub](https://github.com/sabattle/CalypsoBot/issues).
`)
.addField('Member', message.member, true)
.addField('Message', report)
.addField('Message', `\`\`\`${report}\`\`\``)
.setFooter(message.member.displayName, message.author.displayAvatarURL({ dynamic: true }))
.setTimestamp()
.setColor(message.guild.me.displayHexColor);
Expand Down
4 changes: 2 additions & 2 deletions src/commands/mod/addrole.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = class AddRoleCommand extends Command {
constructor(client) {
super(client, {
name: 'addrole',
aliases: ['addr', 'ar'],
aliases: ['giverole', 'addr', 'ar'],
usage: 'addrole <user mention/ID> <role mention/ID> [reason]',
description: 'Adds the specified role to the provided user.',
type: client.types.MOD,
Expand All @@ -26,7 +26,7 @@ module.exports = class AddRoleCommand extends Command {

let reason = args.slice(2).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

if (!role)
return this.sendErrorMessage(message, 0, 'Please mention a role or provide a valid role ID');
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/ban.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = class BanCommand extends Command {

let reason = args.slice(1).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

await member.ban(reason);

Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/clearwarns.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = class ClearWarnsCommand extends Command {

let reason = args.slice(1).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

message.client.db.users.updateWarns.run('', member.id, message.guild.id);

Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/kick.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = class KickCommand extends Command {

let reason = args.slice(1).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

await member.kick(reason);

Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/mute.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = class MuteCommand extends Command {

let reason = args.slice(2).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

if (member.roles.cache.has(muteRoleId))
return this.sendErrorMessage(message, 0, 'Provided member is already muted');
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/purge.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = class PurgeCommand extends Command {

let reason = args.slice(1).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

await message.delete(); // Delete command message

Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/purgebot.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = class PurgeBotCommand extends Command {

let reason = args.slice(1).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

const prefix = message.client.db.settings.selectPrefix.pluck().get(message.guild.id); // Get prefix

Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/removerole.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = class RemoveRoleCommand extends Command {

let reason = args.slice(2).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

if (!role)
return this.sendErrorMessage(message, 0, 'Please mention a role or provide a valid role ID');
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/setnickname.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = class SetNicknameCommand extends Command {

let reason = message.content.split(nickname)[1];
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

try {

Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/slowmode.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = class SlowmodeCommand extends Command {

let reason = args.slice(index + 1).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

await channel.setRateLimitPerUser(rate, reason); // set channel rate
const status = (channel.rateLimitPerUser) ? 'enabled' : 'disabled';
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/softban.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = class SoftBanCommand extends Command {

let reason = args.slice(1).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

await member.ban(reason);
await message.guild.members.unban(member.user, reason);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/unban.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = class UnbanCommand extends Command {

let reason = args.slice(1).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

await message.guild.members.unban(user, reason);
const embed = new MessageEmbed()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/unmute.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = class UnmuteCommand extends Command {

let reason = args.slice(2).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

if (!member.roles.cache.has(muteRoleId))
return this.sendErrorMessage(message, 0, 'Provided member is not muted');
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/warn.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = class WarnCommand extends Command {

let reason = args.slice(1).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

let warns = message.client.db.users.selectWarns.pluck().get(member.id, message.guild.id) || { warns: [] };
if (typeof(warns) == 'string') warns = JSON.parse(warns);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/warnpurge.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = class WarnPurgeCommand extends Command {

let reason = args.slice(2).join(' ');
if (!reason) reason = 'No reason provided.';
if (reason.length > 1024) reason = reason.slice(0, 1015) + '...';
if (reason.length > 1018) reason = reason.slice(0, 1015) + '...';

// Warn
let warns = message.client.db.users.selectWarns.pluck().get(member.id, message.guild.id) || { warns: [] };
Expand Down

0 comments on commit eb2a4df

Please sign in to comment.