Skip to content

Commit

Permalink
Add check on errors message content length
Browse files Browse the repository at this point in the history
  • Loading branch information
iTzArshia committed Nov 17, 2023
1 parent 581edd0 commit f4da5e4
Show file tree
Hide file tree
Showing 11 changed files with 525 additions and 519 deletions.
4 changes: 2 additions & 2 deletions commands/interactions/ask.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: interaction.user.displayAvatarURL()
})
.setDescription(error.response.error.message);
.setDescription(error.response.error.message.length > 4096 ? error.response.error.message.substring(0, 4093) + "..." : error.response.error.message);

await interaction.editReply({ embeds: [embed] }).catch(() => null);

Expand All @@ -133,7 +133,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: interaction.user.displayAvatarURL()
})
.setDescription(error.message);
.setDescription(error.message.length > 4096 ? error.message.substring(0, 4093) + "..." : error.message);

await interaction.editReply({ embeds: [embed] }).catch(() => null);

Expand Down
4 changes: 2 additions & 2 deletions commands/interactions/imagine.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: interaction.user.displayAvatarURL()
})
.setDescription(error.response.error.message);
.setDescription(error.response.error.message.length > 4096 ? error.response.error.message.substring(0, 4093) + "..." : error.response.error.message);

await interaction.editReply({ embeds: [embed] }).catch(() => null);

Expand All @@ -122,7 +122,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: interaction.user.displayAvatarURL()
})
.setDescription(error.message);
.setDescription(error.message.length > 4096 ? error.message.substring(0, 4093) + "..." : error.message);

await interaction.editReply({ embeds: [embed] }).catch(() => null);

Expand Down
4 changes: 2 additions & 2 deletions commands/interactions/optimize.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: interaction.user.displayAvatarURL()
})
.setDescription(error.response.error.message);
.setDescription(error.response.error.message.length > 4096 ? error.response.error.message.substring(0, 4093) + "..." : error.response.error.message);

await interaction.editReply({ embeds: [embed] }).catch(() => null);

Expand All @@ -120,7 +120,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: interaction.user.displayAvatarURL()
})
.setDescription(error.message);
.setDescription(error.message.length > 4096 ? error.message.substring(0, 4093) + "..." : error.message);

await interaction.editReply({ embeds: [embed] }).catch(() => null);

Expand Down
4 changes: 2 additions & 2 deletions commands/interactions/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: interaction.user.displayAvatarURL()
})
.setDescription(error.response.error.message);
.setDescription(error.response.error.message.length > 4096 ? error.response.error.message.substring(0, 4093) + "..." : error.response.error.message);

await interaction.editReply({ embeds: [embed] }).catch(() => null);

Expand All @@ -125,7 +125,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: interaction.user.displayAvatarURL()
})
.setDescription(error.message);
.setDescription(error.message.length > 4096 ? error.message.substring(0, 4093) + "..." : error.message);

await interaction.editReply({ embeds: [embed] }).catch(() => null);

Expand Down
4 changes: 2 additions & 2 deletions commands/messages/ask-gpt 3.5.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.response.error.message);
.setDescription(error.response.error.message.length > 4096 ? error.response.error.message.substring(0, 4093) + "..." : error.response.error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand All @@ -109,7 +109,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.message);
.setDescription(error.message.length > 4096 ? error.message.substring(0, 4093) + "..." : error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand Down
4 changes: 2 additions & 2 deletions commands/messages/ask-gpt 4.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.response.error.message);
.setDescription(error.response.error.message.length > 4096 ? error.response.error.message.substring(0, 4093) + "..." : error.response.error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand All @@ -109,7 +109,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.message);
.setDescription(error.message.length > 4096 ? error.message.substring(0, 4093) + "..." : error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand Down
4 changes: 2 additions & 2 deletions commands/messages/imagine.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.response.error.message);
.setDescription(error.response.error.message.length > 4096 ? error.response.error.message.substring(0, 4093) + "..." : error.response.error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand All @@ -112,7 +112,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.message);
.setDescription(error.message.length > 4096 ? error.message.substring(0, 4093) + "..." : error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand Down
4 changes: 2 additions & 2 deletions commands/messages/optimize.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.response.error.message);
.setDescription(error.response.error.message.length > 4096 ? error.response.error.message.substring(0, 4093) + "..." : error.response.error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand All @@ -98,7 +98,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.message);
.setDescription(error.message.length > 4096 ? error.message.substring(0, 4093) + "..." : error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand Down
4 changes: 2 additions & 2 deletions commands/messages/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.response.error.message);
.setDescription(error.response.error.message.length > 4096 ? error.response.error.message.substring(0, 4093) + "..." : error.response.error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand All @@ -111,7 +111,7 @@ module.exports = {
name: question.length > 256 ? question.substring(0, 253) + "..." : question,
iconURL: message.author.displayAvatarURL()
})
.setDescription(error.message);
.setDescription(error.message.length > 4096 ? error.message.substring(0, 4093) + "..." : error.message);

await message.reply({ embeds: [embed] }).catch(() => null);

Expand Down
Loading

0 comments on commit f4da5e4

Please sign in to comment.