Revert "🚑 config plugin was excluded by .gitignore"

This commit is contained in:
Axel Olausson Holtenäs 2022-06-21 18:01:25 +02:00 committed by GitHub
parent 100e8277c3
commit ffdc228e90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 50 additions and 20 deletions

1
.gitignore vendored
View file

@ -6,7 +6,6 @@ package-lock.json
config/ config/
!plugins/commands/config
# Build # Build
build/ build/

View file

@ -42,7 +42,7 @@ export default async (client: Client) => {
logger.info(`Finished updating command list.`); logger.info(`Finished updating command list.`);
}) })
.catch(async (error) => { .catch(async (error) => {
throw new Error(`Could not update command list: ${error}`); logger.error(`${error}`);
}); });
if (devMode) { if (devMode) {
@ -52,7 +52,7 @@ export default async (client: Client) => {
}) })
.then(async () => logger.info(`Finished updating guild command list.`)) .then(async () => logger.info(`Finished updating guild command list.`))
.catch(async (error) => { .catch(async (error) => {
throw new Error(`Could not update guild command list: ${error}`); logger.error(`${error}`);
}); });
} }
}; };

View file

@ -1,16 +1,19 @@
import { token, intents } from "./config/discord"; import { token, intents } from "./config/discord";
import { Client } from "discord.js"; import { Client } from "discord.js"; // discord.js
import * as managers from "./managers"; import * as managers from "./managers";
// Main process that starts all other sub processes
const main = async () => { const main = async () => {
// Initiate client object
const client = new Client({ const client = new Client({
intents, intents,
}); });
await managers.start(client); await managers.start(client);
// Authorize with Discord's API
await client.login(token); await client.login(token);
}; };

View file

@ -14,11 +14,11 @@ export const start = async () => {
logger.info(`Connected to database: ${connection.connection.name}`); logger.info(`Connected to database: ${connection.connection.name}`);
}) })
.catch(async (e) => { .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) => { mongoose.connection.on("error", async (error) => {
throw new Error(`Could not connect to database: ${error}`); logger.error(`${error}`);
}); });
mongoose.connection.on("warn", async (warning) => { mongoose.connection.on("warn", async (warning) => {

View file

@ -12,7 +12,7 @@ export const register = async (client: Client) => {
const event: IEvent = await import(`../../plugins/events/${eventName}`); const event: IEvent = await import(`../../plugins/events/${eventName}`);
const eventExecutor = async (...args: Promise<void>[]) => const eventExecutor = async (...args: Promise<void>[]) =>
event.execute(...args).catch(async (err) => { event.execute(...args).catch(async (err) => {
throw new Error(`Error executing event ${eventName}: ${err}`); logger.error(`${err}`);
}); });
if (!event.options?.type) return; if (!event.options?.type) return;

View file

@ -201,9 +201,17 @@ export default {
} catch (error) { } catch (error) {
await session.abortTransaction(); await session.abortTransaction();
session.endSession(); session.endSession();
throw new Error( logger.error(`${error}`);
`There was an error while saving the transaction: ${error}`
); return interaction.editReply({
embeds: [
embed
.setDescription(
"An error occurred while trying to gift credits. Please try again."
)
.setColor(errorColor),
],
});
} finally { } finally {
// ending the session // ending the session
session.endSession(); session.endSession();

View file

@ -210,9 +210,21 @@ export default {
} catch (error) { } catch (error) {
await session.abortTransaction(); await session.abortTransaction();
session.endSession(); session.endSession();
throw new Error( logger.error(`${error}`);
`There was an error while transferring credits. ${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 { } finally {
// ending the session // ending the session
session.endSession(); session.endSession();

View file

@ -57,7 +57,7 @@ export default {
); );
}) })
.catch(async () => { .catch(async () => {
throw new Error( logger.error(
`Audit log failed to send for event interactionCreate in guild ${interaction?.guild?.name} (${interaction?.guild?.id})` `Audit log failed to send for event interactionCreate in guild ${interaction?.guild?.name} (${interaction?.guild?.id})`
); );
}); });

View file

@ -58,7 +58,10 @@ export default {
); );
}) })
.catch(async (err) => { .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( logger.silly(

View file

@ -38,8 +38,8 @@ export default {
); );
}) })
.catch(async (err) => { .catch(async (err) => {
throw new Error( logger.error(
`Error saving user ${userId} in guild ${guildId}: ${err}` `Error saving credits for user ${userId} in guild ${guildId} - ${err}`
); );
}); });
}, },

View file

@ -35,7 +35,10 @@ export default {
); );
}) })
.catch(async (err) => { .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( logger.silly(

View file

@ -58,7 +58,9 @@ export default {
); );
}) })
.catch(async () => { .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})`
);
}); });
}, },
}; };

View file

@ -60,7 +60,7 @@ export default {
); );
}) })
.catch(async () => { .catch(async () => {
throw new Error( logger.error(
`Audit log failed to send for event messageUpdate in guild ${newMessage?.guild?.name} (${newMessage?.guild?.id})` `Audit log failed to send for event messageUpdate in guild ${newMessage?.guild?.name} (${newMessage?.guild?.id})`
); );
}); });