Merge pull request #424 from VermiumSifell/dev
🧑💻 Fixed some more code smells again
This commit is contained in:
commit
363a5ef0cd
3 changed files with 14 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable no-loops/no-loops */
|
||||
import { EmbedBuilder, Message, TextChannel } from "discord.js";
|
||||
import { ChannelType, EmbedBuilder, Message } from "discord.js";
|
||||
import getEmbedConfig from "../../../helpers/getEmbedData";
|
||||
import logger from "../../../middlewares/logger";
|
||||
import guildSchema from "../../../models/guild";
|
||||
|
@ -29,9 +29,10 @@ export default {
|
|||
|
||||
const channel = client.channels.cache.get(`${guildData.audits.channelId}`);
|
||||
|
||||
if (channel === null) return;
|
||||
if (!channel) return;
|
||||
if (channel.type !== ChannelType.GuildText) return;
|
||||
|
||||
(channel as TextChannel)
|
||||
channel
|
||||
.send({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
|
@ -52,13 +53,13 @@ export default {
|
|||
}),
|
||||
],
|
||||
})
|
||||
.then(async () => {
|
||||
.then(() => {
|
||||
logger.info(
|
||||
`Audit log sent for event messageUpdate in guild ${newMessage?.guild?.name} (${newMessage?.guild?.id})`
|
||||
);
|
||||
})
|
||||
.catch(async () => {
|
||||
logger.error(
|
||||
.catch(() => {
|
||||
throw new Error(
|
||||
`Audit log failed to send for event messageUpdate in guild ${newMessage?.guild?.name} (${newMessage?.guild?.id})`
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Dependencies
|
||||
import { Message } from "discord.js";
|
||||
|
||||
// Models
|
||||
import logger from "../../../../middlewares/logger";
|
||||
import counterSchema from "../../../../models/counter";
|
||||
|
@ -24,12 +23,12 @@ export default async (message: Message) => {
|
|||
);
|
||||
|
||||
await message
|
||||
?.delete()
|
||||
?.then(async () => {
|
||||
.delete()
|
||||
.then(async () => {
|
||||
await channel?.send(`${author} said **${word}**.`);
|
||||
logger?.silly(`${author} said ${word} in ${channel}`);
|
||||
})
|
||||
?.catch(async (error) => {
|
||||
logger?.error(error);
|
||||
.catch((error) => {
|
||||
logger.error(error);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Dependencies
|
||||
import { Client } from "discord.js";
|
||||
import logger from "../../../middlewares/logger";
|
||||
|
||||
// Helpers
|
||||
import { IEventOptions } from "../../../interfaces/EventOptions";
|
||||
import logger from "../../../middlewares/logger";
|
||||
|
||||
export const options: IEventOptions = {
|
||||
type: "on",
|
||||
};
|
||||
|
||||
export const execute = async (client: Client) => {
|
||||
// Function to execute the event
|
||||
export const execute = (client: Client) => {
|
||||
logger.warn(`Discord's API client (${client?.user?.tag}) is rate-limited!`);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue