refactor: ♻️ Fixed more code smells
I have fixed more code smells
This commit is contained in:
parent
c6d6547881
commit
0f8ea8ad2b
6 changed files with 10 additions and 7 deletions
|
@ -142,6 +142,5 @@ export default {
|
||||||
await interaction?.editReply({
|
await interaction?.editReply({
|
||||||
embeds: [interactionEmbed],
|
embeds: [interactionEmbed],
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -188,7 +188,6 @@ export default {
|
||||||
await interaction?.editReply({
|
await interaction?.editReply({
|
||||||
embeds: [interactionEmbed],
|
embeds: [interactionEmbed],
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,7 +22,10 @@ export default {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!channelCounter) return logger.debug("No counters found in channel.");
|
if (!channelCounter) {
|
||||||
|
logger.debug("No counters found in channel.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
lastMessage?.author.id === author.id &&
|
lastMessage?.author.id === author.id &&
|
||||||
|
@ -32,7 +35,7 @@ export default {
|
||||||
`${author.username} sent the last message therefor not allowing again.`
|
`${author.username} sent the last message therefor not allowing again.`
|
||||||
);
|
);
|
||||||
await message.delete();
|
await message.delete();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content !== channelCounter.triggerWord) {
|
if (content !== channelCounter.triggerWord) {
|
||||||
|
@ -41,7 +44,7 @@ export default {
|
||||||
);
|
);
|
||||||
|
|
||||||
await message.delete();
|
await message.delete();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateGuildCounter = await prisma.guildCounter.update({
|
const updateGuildCounter = await prisma.guildCounter.update({
|
||||||
|
|
|
@ -32,7 +32,7 @@ export default async (message: Message) => {
|
||||||
|
|
||||||
channel?.send(`${author} said **${channelCounter.triggerWord}**.`);
|
channel?.send(`${author} said **${channelCounter.triggerWord}**.`);
|
||||||
logger?.silly(`${author} said ${channelCounter.triggerWord} in ${channel}`);
|
logger?.silly(`${author} said ${channelCounter.triggerWord} in ${channel}`);
|
||||||
return logger?.silly(
|
logger?.silly(
|
||||||
`User: ${author?.tag} (${author?.id}) in guild: ${guild?.name} (${guild?.id}) said the counter word: ${channelCounter.triggerWord}`
|
`User: ${author?.tag} (${author?.id}) in guild: ${guild?.name} (${guild?.id}) said the counter word: ${channelCounter.triggerWord}`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,4 +25,5 @@ export const execute = async (oldMessage: Message, newMessage: Message) => {
|
||||||
if (author?.bot) return logger?.silly(`Message update event fired by bot`);
|
if (author?.bot) return logger?.silly(`Message update event fired by bot`);
|
||||||
|
|
||||||
await counter(newMessage);
|
await counter(newMessage);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Dependencies
|
1; // Dependencies
|
||||||
import { Message } from "discord.js";
|
import { Message } from "discord.js";
|
||||||
// Models
|
// Models
|
||||||
import prisma from "../../../handlers/database";
|
import prisma from "../../../handlers/database";
|
||||||
|
@ -38,4 +38,5 @@ export default async (message: Message) => {
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue