diff --git a/README.md b/README.md index b556733..037fb23 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Poixpixel's Discord Bot > [!WARNING] -> This Discord bot is not production ready. +> This Discord bot is not production ready and is still in a testing state. > [!TIP] > Want to see the bot in action? [Join our Discord server](https://discord.gg/KRTGjxx7gY). diff --git a/src/commands/fun/counting.ts b/src/commands/fun/counting.ts index fb8bbce..ce7cb6c 100644 --- a/src/commands/fun/counting.ts +++ b/src/commands/fun/counting.ts @@ -4,9 +4,9 @@ import { PermissionsBitField, } from 'discord.js'; -import { SubcommandCommand } from '../../types/CommandTypes.js'; -import { getCountingData, setCount } from '../../util/countingManager.js'; -import { loadConfig } from '../../util/configLoader.js'; +import { SubcommandCommand } from '@/types/CommandTypes.js'; +import { getCountingData, setCount } from '@/util/countingManager.js'; +import { loadConfig } from '@/util/configLoader.js'; const command: SubcommandCommand = { data: new SlashCommandBuilder() diff --git a/src/commands/fun/fact.ts b/src/commands/fun/fact.ts index b0b4c93..4848932 100644 --- a/src/commands/fun/fact.ts +++ b/src/commands/fun/fact.ts @@ -13,10 +13,10 @@ import { approveFact, deleteFact, getLastInsertedFactId, -} from '../../db/db.js'; -import { postFactOfTheDay } from '../../util/factManager.js'; -import { loadConfig } from '../../util/configLoader.js'; -import { SubcommandCommand } from '../../types/CommandTypes.js'; +} from '@/db/db.js'; +import { postFactOfTheDay } from '@/util/factManager.js'; +import { loadConfig } from '@/util/configLoader.js'; +import { SubcommandCommand } from '@/types/CommandTypes.js'; const command: SubcommandCommand = { data: new SlashCommandBuilder() diff --git a/src/commands/fun/leaderboard.ts b/src/commands/fun/leaderboard.ts index 0d37fef..02b3ad1 100644 --- a/src/commands/fun/leaderboard.ts +++ b/src/commands/fun/leaderboard.ts @@ -9,8 +9,8 @@ import { JSONEncodable, } from 'discord.js'; -import { OptionsCommand } from '../../types/CommandTypes.js'; -import { getLevelLeaderboard } from '../../db/db.js'; +import { OptionsCommand } from '@/types/CommandTypes.js'; +import { getLevelLeaderboard } from '@/db/db.js'; const command: OptionsCommand = { data: new SlashCommandBuilder() diff --git a/src/commands/fun/rank.ts b/src/commands/fun/rank.ts index 0007d05..7863779 100644 --- a/src/commands/fun/rank.ts +++ b/src/commands/fun/rank.ts @@ -1,11 +1,8 @@ -import { GuildMember, SlashCommandBuilder } from 'discord.js'; +import { SlashCommandBuilder } from 'discord.js'; -import { OptionsCommand } from '../../types/CommandTypes.js'; -import { - generateRankCard, - getXpToNextLevel, -} from '../../util/levelingSystem.js'; -import { getUserLevel } from '../../db/db.js'; +import { OptionsCommand } from '@/types/CommandTypes.js'; +import { generateRankCard, getXpToNextLevel } from '@/util/levelingSystem.js'; +import { getUserLevel } from '@/db/db.js'; const command: OptionsCommand = { data: new SlashCommandBuilder() diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 4cbc40f..84a5ee8 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -1,9 +1,9 @@ import { PermissionsBitField, SlashCommandBuilder } from 'discord.js'; -import { updateMember, updateMemberModerationHistory } from '../../db/db.js'; -import { parseDuration, scheduleUnban } from '../../util/helpers.js'; -import { OptionsCommand } from '../../types/CommandTypes.js'; -import logAction from '../../util/logging/logAction.js'; +import { updateMember, updateMemberModerationHistory } from '@/db/db.js'; +import { parseDuration, scheduleUnban } from '@/util/helpers.js'; +import { OptionsCommand } from '@/types/CommandTypes.js'; +import logAction from '@/util/logging/logAction.js'; const command: OptionsCommand = { data: new SlashCommandBuilder() diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index 8a458f2..c160148 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -1,7 +1,7 @@ import { PermissionsBitField, SlashCommandBuilder } from 'discord.js'; -import { executeUnban } from '../../util/helpers.js'; -import { OptionsCommand } from '../../types/CommandTypes.js'; +import { executeUnban } from '@/util/helpers.js'; +import { OptionsCommand } from '@/types/CommandTypes.js'; const command: OptionsCommand = { data: new SlashCommandBuilder() diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index c92c7ae..be2f386 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -1,8 +1,8 @@ import { PermissionsBitField, SlashCommandBuilder } from 'discord.js'; -import { updateMemberModerationHistory } from '../../db/db.js'; -import { OptionsCommand } from '../../types/CommandTypes.js'; -import logAction from '../../util/logging/logAction.js'; +import { updateMemberModerationHistory } from '@/db/db.js'; +import { OptionsCommand } from '@/types/CommandTypes.js'; +import logAction from '@/util/logging/logAction.js'; const command: OptionsCommand = { data: new SlashCommandBuilder() diff --git a/src/commands/testing/testJoin.ts b/src/commands/testing/testJoin.ts index b1998e0..cf66f6b 100644 --- a/src/commands/testing/testJoin.ts +++ b/src/commands/testing/testJoin.ts @@ -1,6 +1,6 @@ import { PermissionsBitField, SlashCommandBuilder } from 'discord.js'; -import { Command } from '../../types/CommandTypes.js'; +import { Command } from '@/types/CommandTypes.js'; const command: Command = { data: new SlashCommandBuilder() diff --git a/src/commands/testing/testLeave.ts b/src/commands/testing/testLeave.ts index b643b0e..1aba95c 100644 --- a/src/commands/testing/testLeave.ts +++ b/src/commands/testing/testLeave.ts @@ -1,7 +1,7 @@ import { PermissionsBitField, SlashCommandBuilder } from 'discord.js'; -import { updateMember } from '../../db/db.js'; -import { Command } from '../../types/CommandTypes.js'; +import { updateMember } from '@/db/db.js'; +import { Command } from '@/types/CommandTypes.js'; const command: Command = { data: new SlashCommandBuilder() diff --git a/src/commands/util/members.ts b/src/commands/util/members.ts index e1bc945..6e3b8d9 100644 --- a/src/commands/util/members.ts +++ b/src/commands/util/members.ts @@ -9,8 +9,8 @@ import { JSONEncodable, } from 'discord.js'; -import { getAllMembers } from '../../db/db.js'; -import { Command } from '../../types/CommandTypes.js'; +import { getAllMembers } from '@/db/db.js'; +import { Command } from '@/types/CommandTypes.js'; const command: Command = { data: new SlashCommandBuilder() diff --git a/src/commands/util/ping.ts b/src/commands/util/ping.ts index ed64529..5e2bddc 100644 --- a/src/commands/util/ping.ts +++ b/src/commands/util/ping.ts @@ -1,6 +1,6 @@ import { SlashCommandBuilder } from 'discord.js'; -import { Command } from '../../types/CommandTypes.js'; +import { Command } from '@/types/CommandTypes.js'; const command: Command = { data: new SlashCommandBuilder() diff --git a/src/commands/util/recalculatelevels.ts b/src/commands/util/recalculatelevels.ts index 0667d1a..4c30806 100644 --- a/src/commands/util/recalculatelevels.ts +++ b/src/commands/util/recalculatelevels.ts @@ -1,7 +1,7 @@ import { PermissionsBitField, SlashCommandBuilder } from 'discord.js'; -import { Command } from '../../types/CommandTypes.js'; -import { recalculateUserLevels } from '../../util/levelingSystem.js'; +import { Command } from '@/types/CommandTypes.js'; +import { recalculateUserLevels } from '@/util/levelingSystem.js'; const command: Command = { data: new SlashCommandBuilder() diff --git a/src/commands/util/reconnect.ts b/src/commands/util/reconnect.ts index a4ed8f0..886fcca 100644 --- a/src/commands/util/reconnect.ts +++ b/src/commands/util/reconnect.ts @@ -4,17 +4,14 @@ import { SlashCommandBuilder, } from 'discord.js'; -import { SubcommandCommand } from '../../types/CommandTypes.js'; -import { loadConfig } from '../../util/configLoader.js'; -import { - initializeDatabaseConnection, - ensureDbInitialized, -} from '../../db/db.js'; -import { isRedisConnected } from '../../db/redis.js'; +import { SubcommandCommand } from '@/types/CommandTypes.js'; +import { loadConfig } from '@/util/configLoader.js'; +import { initializeDatabaseConnection, ensureDbInitialized } from '@/db/db.js'; +import { isRedisConnected } from '@/db/redis.js'; import { NotificationType, notifyManagers, -} from '../../util/notificationHandler.js'; +} from '@/util/notificationHandler.js'; const command: SubcommandCommand = { data: new SlashCommandBuilder() @@ -123,7 +120,7 @@ async function handleRedisReconnect(interaction: CommandInteraction) { await interaction.editReply('Attempting to reconnect to Redis...'); try { - const redisModule = await import('../../db/redis.js'); + const redisModule = await import('@/db/redis.js'); await redisModule.ensureRedisConnection(); diff --git a/src/commands/util/restart.ts b/src/commands/util/restart.ts index bf7afb4..31ecfc9 100644 --- a/src/commands/util/restart.ts +++ b/src/commands/util/restart.ts @@ -2,14 +2,14 @@ import { PermissionsBitField, SlashCommandBuilder } from 'discord.js'; import { exec } from 'child_process'; import { promisify } from 'util'; -import { Command } from '../../types/CommandTypes.js'; -import { loadConfig } from '../../util/configLoader.js'; +import { Command } from '@/types/CommandTypes.js'; +import { loadConfig } from '@/util/configLoader.js'; import { NotificationType, notifyManagers, -} from '../../util/notificationHandler.js'; -import { isRedisConnected } from '../../db/redis.js'; -import { ensureDatabaseConnection } from '../../db/db.js'; +} from '@/util/notificationHandler.js'; +import { isRedisConnected } from '@/db/redis.js'; +import { ensureDatabaseConnection } from '@/db/db.js'; const execAsync = promisify(exec); diff --git a/src/commands/util/rules.ts b/src/commands/util/rules.ts index c8ff029..8720c1a 100644 --- a/src/commands/util/rules.ts +++ b/src/commands/util/rules.ts @@ -1,6 +1,6 @@ import { SlashCommandBuilder, EmbedBuilder } from 'discord.js'; -import { Command } from '../../types/CommandTypes.js'; +import { Command } from '@/types/CommandTypes.js'; const rulesEmbed = new EmbedBuilder() .setColor(0x0099ff) diff --git a/src/commands/util/server.ts b/src/commands/util/server.ts index a391e03..766c9f0 100644 --- a/src/commands/util/server.ts +++ b/src/commands/util/server.ts @@ -1,6 +1,6 @@ import { SlashCommandBuilder } from 'discord.js'; -import { Command } from '../../types/CommandTypes.js'; +import { Command } from '@/types/CommandTypes.js'; const command: Command = { data: new SlashCommandBuilder() diff --git a/src/commands/util/user-info.ts b/src/commands/util/user-info.ts index 7f1ac68..7b0a52b 100644 --- a/src/commands/util/user-info.ts +++ b/src/commands/util/user-info.ts @@ -5,8 +5,8 @@ import { PermissionsBitField, } from 'discord.js'; -import { getMember } from '../../db/db.js'; -import { OptionsCommand } from '../../types/CommandTypes.js'; +import { getMember } from '@/db/db.js'; +import { OptionsCommand } from '@/types/CommandTypes.js'; const command: OptionsCommand = { data: new SlashCommandBuilder() diff --git a/src/commands/util/xp.ts b/src/commands/util/xp.ts index cac94e8..979da6a 100644 --- a/src/commands/util/xp.ts +++ b/src/commands/util/xp.ts @@ -1,8 +1,8 @@ import { SlashCommandBuilder } from 'discord.js'; -import { SubcommandCommand } from '../../types/CommandTypes.js'; -import { addXpToUser, getUserLevel } from '../../db/db.js'; -import { loadConfig } from '../../util/configLoader.js'; +import { SubcommandCommand } from '@/types/CommandTypes.js'; +import { addXpToUser, getUserLevel } from '@/db/db.js'; +import { loadConfig } from '@/util/configLoader.js'; const command: SubcommandCommand = { data: new SlashCommandBuilder() diff --git a/src/db/redis.ts b/src/db/redis.ts index 6b58f6b..7897caa 100644 --- a/src/db/redis.ts +++ b/src/db/redis.ts @@ -1,12 +1,12 @@ import Redis from 'ioredis'; import { Client } from 'discord.js'; -import { loadConfig } from '../util/configLoader.js'; +import { loadConfig } from '@/util/configLoader.js'; import { logManagerNotification, NotificationType, notifyManagers, -} from '../util/notificationHandler.js'; +} from '@/util/notificationHandler.js'; const config = loadConfig(); diff --git a/src/discord-bot.ts b/src/discord-bot.ts index d7a5c81..3f6c254 100644 --- a/src/discord-bot.ts +++ b/src/discord-bot.ts @@ -1,6 +1,6 @@ import { GatewayIntentBits } from 'discord.js'; -import { ExtendedClient } from './structures/ExtendedClient.js'; -import { loadConfig } from './util/configLoader.js'; +import { ExtendedClient } from '@/structures/ExtendedClient.js'; +import { loadConfig } from '@/util/configLoader.js'; async function startBot() { try { diff --git a/src/events/channelEvents.ts b/src/events/channelEvents.ts index 523eb29..0978017 100644 --- a/src/events/channelEvents.ts +++ b/src/events/channelEvents.ts @@ -7,9 +7,9 @@ import { PermissionOverwrites, } from 'discord.js'; -import { ChannelLogAction } from '../util/logging/types.js'; -import { Event } from '../types/EventTypes.js'; -import logAction from '../util/logging/logAction.js'; +import { ChannelLogAction } from '@/util/logging/types.js'; +import { Event } from '@/types/EventTypes.js'; +import logAction from '@/util/logging/logAction.js'; function arePermissionsEqual( oldPerms: Map, diff --git a/src/events/memberEvents.ts b/src/events/memberEvents.ts index 671f99a..655547d 100644 --- a/src/events/memberEvents.ts +++ b/src/events/memberEvents.ts @@ -1,16 +1,15 @@ import { Collection, Events, - Guild, GuildMember, PartialGuildMember, } from 'discord.js'; -import { updateMember, setMembers } from '../db/db.js'; -import { generateMemberBanner } from '../util/helpers.js'; -import { loadConfig } from '../util/configLoader.js'; -import { Event } from '../types/EventTypes.js'; -import logAction from '../util/logging/logAction.js'; +import { updateMember, setMembers } from '@/db/db.js'; +import { generateMemberBanner } from '@/util/helpers.js'; +import { loadConfig } from '@/util/configLoader.js'; +import { Event } from '@/types/EventTypes.js'; +import logAction from '@/util/logging/logAction.js'; export const memberJoin: Event = { name: Events.GuildMemberAdd, diff --git a/src/events/messageEvents.ts b/src/events/messageEvents.ts index 07d0595..440b1f2 100644 --- a/src/events/messageEvents.ts +++ b/src/events/messageEvents.ts @@ -1,17 +1,17 @@ import { AuditLogEvent, Events, Message, PartialMessage } from 'discord.js'; -import { Event } from '../types/EventTypes.js'; -import { loadConfig } from '../util/configLoader.js'; +import { Event } from '@/types/EventTypes.js'; +import { loadConfig } from '@/util/configLoader.js'; import { addCountingReactions, processCountingMessage, resetCounting, -} from '../util/countingManager.js'; -import logAction from '../util/logging/logAction.js'; +} from '@/util/countingManager.js'; +import logAction from '@/util/logging/logAction.js'; import { checkAndAssignLevelRoles, processMessage, -} from '../util/levelingSystem.js'; +} from '@/util/levelingSystem.js'; export const messageDelete: Event = { name: Events.MessageDelete, diff --git a/src/events/roleEvents.ts b/src/events/roleEvents.ts index 8fc06f6..a45b471 100644 --- a/src/events/roleEvents.ts +++ b/src/events/roleEvents.ts @@ -1,7 +1,7 @@ import { AuditLogEvent, Events, Role } from 'discord.js'; -import { Event } from '../types/EventTypes.js'; -import logAction from '../util/logging/logAction.js'; +import { Event } from '@/types/EventTypes.js'; +import logAction from '@/util/logging/logAction.js'; const convertRoleProperties = (role: Role) => ({ name: role.name, diff --git a/src/structures/ExtendedClient.ts b/src/structures/ExtendedClient.ts index bf0d153..6cf3d9d 100644 --- a/src/structures/ExtendedClient.ts +++ b/src/structures/ExtendedClient.ts @@ -1,8 +1,8 @@ import { Client, ClientOptions, Collection } from 'discord.js'; -import { Command } from '../types/CommandTypes.js'; -import { Config } from '../types/ConfigTypes.js'; -import { deployCommands } from '../util/deployCommand.js'; -import { registerEvents } from '../util/eventLoader.js'; +import { Command } from '@/types/CommandTypes.js'; +import { Config } from '@/types/ConfigTypes.js'; +import { deployCommands } from '@/util/deployCommand.js'; +import { registerEvents } from '@/util/eventLoader.js'; /** * Extended client class that extends the default Client class diff --git a/src/util/configLoader.ts b/src/util/configLoader.ts index 4a847dc..9c61352 100644 --- a/src/util/configLoader.ts +++ b/src/util/configLoader.ts @@ -1,7 +1,8 @@ -import { Config } from '../types/ConfigTypes.js'; import fs from 'node:fs'; import path from 'node:path'; +import { Config } from '@/types/ConfigTypes.js'; + /** * Loads the config file from the root directory * @returns - The loaded config object diff --git a/src/util/countingManager.ts b/src/util/countingManager.ts index a3beb67..b1b37d9 100644 --- a/src/util/countingManager.ts +++ b/src/util/countingManager.ts @@ -1,6 +1,6 @@ import { Message } from 'discord.js'; -import { getJson, setJson } from '../db/redis.js'; +import { getJson, setJson } from '@/db/redis.js'; interface CountingData { currentCount: number; diff --git a/src/util/factManager.ts b/src/util/factManager.ts index d146f67..56aa654 100644 --- a/src/util/factManager.ts +++ b/src/util/factManager.ts @@ -1,6 +1,6 @@ import { EmbedBuilder, Client } from 'discord.js'; -import { getRandomUnusedFact, markFactAsUsed } from '../db/db.js'; +import { getRandomUnusedFact, markFactAsUsed } from '@/db/db.js'; import { loadConfig } from './configLoader.js'; let isFactScheduled = false; diff --git a/src/util/levelingSystem.ts b/src/util/levelingSystem.ts index ba42ea6..721dc81 100644 --- a/src/util/levelingSystem.ts +++ b/src/util/levelingSystem.ts @@ -8,8 +8,8 @@ import { getUserLevel, getUserRank, handleDbError, -} from '../db/db.js'; -import * as schema from '../db/schema.js'; +} from '@/db/db.js'; +import * as schema from '@/db/schema.js'; import { loadConfig } from './configLoader.js'; import { roundRect } from './helpers.js';