mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
Merge pull request #115 from mariusbegby/iasjdoifjadsf
evening improvements :)
This commit is contained in:
3 files changed
+5
-29
No files matched your search
@@ -89,7 +89,7 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
const confirmation = await response.awaitMessageComponent({
|
const confirmation = await response.awaitMessageComponent({
|
||||||
filter: collectorFilter,
|
filter: collectorFilter,
|
||||||
time: 60000
|
time: 300_000
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
const confirmation = await response.awaitMessageComponent({
|
const confirmation = await response.awaitMessageComponent({
|
||||||
filter: collectorFilter,
|
filter: collectorFilter,
|
||||||
time: 60000
|
time: 300_000
|
||||||
});
|
});
|
||||||
|
|
||||||
confirmation.deferUpdate();
|
confirmation.deferUpdate();
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ module.exports = {
|
|||||||
name: Events.InteractionCreate,
|
name: Events.InteractionCreate,
|
||||||
isDebug: false,
|
isDebug: false,
|
||||||
execute: async (interaction, { client }) => {
|
execute: async (interaction, { client }) => {
|
||||||
if (await cannotSendMessageInChannel(interaction)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const command = client.commands.get(interaction.commandName);
|
const command = client.commands.get(interaction.commandName);
|
||||||
if (!command) {
|
if (!command) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
@@ -34,6 +30,9 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
} else if (interaction.isChatInputCommand()) {
|
} else if (interaction.isChatInputCommand()) {
|
||||||
try {
|
try {
|
||||||
|
if (await cannotSendMessageInChannel(interaction)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const inputTime = new Date();
|
const inputTime = new Date();
|
||||||
|
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
@@ -43,32 +42,9 @@ module.exports = {
|
|||||||
const executionTime = outputTime - inputTime;
|
const executionTime = outputTime - inputTime;
|
||||||
|
|
||||||
if (executionTime > 20000) {
|
if (executionTime > 20000) {
|
||||||
// don't send warning message for commands with collector timeouts, as collector timeout happens after 60 seconds
|
|
||||||
if (
|
|
||||||
(interaction.commandName === 'filters' || interaction.commandName === 'nowplaying') &&
|
|
||||||
executionTime > 55000
|
|
||||||
) {
|
|
||||||
logger.info(
|
|
||||||
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' executed in ${executionTime} ms.`
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' took ${executionTime} ms to execute.`
|
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' took ${executionTime} ms to execute.`
|
||||||
);
|
);
|
||||||
|
|
||||||
return await interaction.followUp({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setDescription(
|
|
||||||
`**${embedOptions.icons.warning} Warning**\nThis command took ${
|
|
||||||
executionTime / 1000
|
|
||||||
} seconds to execute.\n\n_If you experienced problems with the command, please try again._`
|
|
||||||
)
|
|
||||||
.setColor(embedOptions.colors.warning)
|
|
||||||
]
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
logger.info(
|
logger.info(
|
||||||
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' executed in ${executionTime} ms.`
|
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' executed in ${executionTime} ms.`
|
||||||
|
|||||||
Reference in new issue
Block a user