Revert "🚑 config plugin was excluded by .gitignore"
This commit is contained in:
parent
100e8277c3
commit
ffdc228e90
13 changed files with 50 additions and 20 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,7 +6,6 @@ package-lock.json
|
|||
|
||||
|
||||
config/
|
||||
!plugins/commands/config
|
||||
|
||||
# Build
|
||||
build/
|
||||
|
|
|
@ -42,7 +42,7 @@ export default async (client: Client) => {
|
|||
logger.info(`Finished updating command list.`);
|
||||
})
|
||||
.catch(async (error) => {
|
||||
throw new Error(`Could not update command list: ${error}`);
|
||||
logger.error(`${error}`);
|
||||
});
|
||||
|
||||
if (devMode) {
|
||||
|
@ -52,7 +52,7 @@ export default async (client: Client) => {
|
|||
})
|
||||
.then(async () => logger.info(`Finished updating guild command list.`))
|
||||
.catch(async (error) => {
|
||||
throw new Error(`Could not update guild command list: ${error}`);
|
||||
logger.error(`${error}`);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
import { token, intents } from "./config/discord";
|
||||
|
||||
import { Client } from "discord.js";
|
||||
import { Client } from "discord.js"; // discord.js
|
||||
|
||||
import * as managers from "./managers";
|
||||
|
||||
// Main process that starts all other sub processes
|
||||
const main = async () => {
|
||||
// Initiate client object
|
||||
const client = new Client({
|
||||
intents,
|
||||
});
|
||||
|
||||
await managers.start(client);
|
||||
|
||||
// Authorize with Discord's API
|
||||
await client.login(token);
|
||||
};
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ export const start = async () => {
|
|||
logger.info(`Connected to database: ${connection.connection.name}`);
|
||||
})
|
||||
.catch(async (e) => {
|
||||
throw new Error(`Error connecting to database: ${e}`);
|
||||
logger.error("Could not connect to database", e);
|
||||
});
|
||||
|
||||
mongoose.connection.on("error", async (error) => {
|
||||
throw new Error(`Could not connect to database: ${error}`);
|
||||
logger.error(`${error}`);
|
||||
});
|
||||
|
||||
mongoose.connection.on("warn", async (warning) => {
|
||||
|
|
|
@ -12,7 +12,7 @@ export const register = async (client: Client) => {
|
|||
const event: IEvent = await import(`../../plugins/events/${eventName}`);
|
||||
const eventExecutor = async (...args: Promise<void>[]) =>
|
||||
event.execute(...args).catch(async (err) => {
|
||||
throw new Error(`Error executing event ${eventName}: ${err}`);
|
||||
logger.error(`${err}`);
|
||||
});
|
||||
if (!event.options?.type) return;
|
||||
|
||||
|
|
|
@ -201,9 +201,17 @@ export default {
|
|||
} catch (error) {
|
||||
await session.abortTransaction();
|
||||
session.endSession();
|
||||
throw new Error(
|
||||
`There was an error while saving the transaction: ${error}`
|
||||
);
|
||||
logger.error(`${error}`);
|
||||
|
||||
return interaction.editReply({
|
||||
embeds: [
|
||||
embed
|
||||
.setDescription(
|
||||
"An error occurred while trying to gift credits. Please try again."
|
||||
)
|
||||
.setColor(errorColor),
|
||||
],
|
||||
});
|
||||
} finally {
|
||||
// ending the session
|
||||
session.endSession();
|
||||
|
|
|
@ -210,9 +210,21 @@ export default {
|
|||
} catch (error) {
|
||||
await session.abortTransaction();
|
||||
session.endSession();
|
||||
throw new Error(
|
||||
`There was an error while transferring credits. ${error}`
|
||||
);
|
||||
logger.error(`${error}`);
|
||||
|
||||
return interaction.editReply({
|
||||
embeds: [
|
||||
new MessageEmbed()
|
||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
||||
.setDescription(
|
||||
"An error occurred while trying to gift credits. Please try again."
|
||||
)
|
||||
.setColor(errorColor)
|
||||
.setTimestamp(new Date())
|
||||
.setColor(successColor)
|
||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
||||
],
|
||||
});
|
||||
} finally {
|
||||
// ending the session
|
||||
session.endSession();
|
||||
|
|
|
@ -57,7 +57,7 @@ export default {
|
|||
);
|
||||
})
|
||||
.catch(async () => {
|
||||
throw new Error(
|
||||
logger.error(
|
||||
`Audit log failed to send for event interactionCreate in guild ${interaction?.guild?.name} (${interaction?.guild?.id})`
|
||||
);
|
||||
});
|
||||
|
|
|
@ -58,7 +58,10 @@ export default {
|
|||
);
|
||||
})
|
||||
.catch(async (err) => {
|
||||
throw new Error(`There was an error saving the counter: ${err}`);
|
||||
logger.error(
|
||||
`Error saving counter for guild ${guildId} and channel ${channelId}`,
|
||||
err
|
||||
);
|
||||
});
|
||||
|
||||
logger.silly(
|
||||
|
|
|
@ -38,8 +38,8 @@ export default {
|
|||
);
|
||||
})
|
||||
.catch(async (err) => {
|
||||
throw new Error(
|
||||
`Error saving user ${userId} in guild ${guildId}: ${err}`
|
||||
logger.error(
|
||||
`Error saving credits for user ${userId} in guild ${guildId} - ${err}`
|
||||
);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -35,7 +35,10 @@ export default {
|
|||
);
|
||||
})
|
||||
.catch(async (err) => {
|
||||
throw new Error(`There was an error saving the user: ${err}`);
|
||||
logger.error(
|
||||
`Error saving points for user ${author.tag} (${author.id}) in guild: ${guild?.name} (${guild?.id})`,
|
||||
err
|
||||
);
|
||||
});
|
||||
|
||||
logger.silly(
|
||||
|
|
|
@ -58,7 +58,9 @@ export default {
|
|||
);
|
||||
})
|
||||
.catch(async () => {
|
||||
throw new Error(`There was an error sending the audit log`);
|
||||
logger.error(
|
||||
`Audit log failed to send for event messageDelete in guild ${message?.guild?.name} (${message?.guild?.id})`
|
||||
);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -60,7 +60,7 @@ export default {
|
|||
);
|
||||
})
|
||||
.catch(async () => {
|
||||
throw new Error(
|
||||
logger.error(
|
||||
`Audit log failed to send for event messageUpdate in guild ${newMessage?.guild?.name} (${newMessage?.guild?.id})`
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue