refactor(arabot): use absolute paths

This commit is contained in:
smyalygames 2023-02-07 00:59:37 +00:00
parent 45c19824c5
commit 937e874d66
63 changed files with 743 additions and 363 deletions

View File

@ -14,9 +14,24 @@
"project": "tsconfig.json"
},
"plugins": [
"@typescript-eslint"
"@typescript-eslint",
"import"
],
"rules": {
"import/no-unresolved": "error",
"class-methods-use-this": "off"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".tsx"
]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
}
}

925
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,9 @@
"start": "node dist/index.js",
"start:migrate": "prisma migrate deploy && npm run start"
},
"imports": {
"#utils/*": "./dist/utils/*.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/veganhacktivists/arabot.git"
@ -48,7 +51,8 @@
"eslint": "8.22.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-plugin-import": "^2.27.5",
"prisma": "^4.4.0"
}
}

View File

@ -19,7 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework';
import { ChannelType, TextChannel, VoiceChannel } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class AccessCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -27,7 +27,7 @@ import {
PermissionsBitField, Snowflake,
time,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class PrivateCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder } from 'discord.js';
import { N1984 } from '@utils/gifs';
import { N1984 } from '#utils/gifs';
class N1984Command extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder } from 'discord.js';
import { Happy } from '@utils/gifs';
import { Happy } from '#utils/gifs';
class HappyCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder } from 'discord.js';
import { Hugs } from '@utils/gifs';
import { Hugs } from '#utils/gifs';
class HugCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder } from 'discord.js';
import { Kill } from '@utils/gifs';
import { Kill } from '#utils/gifs';
class KillCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder } from 'discord.js';
import { Poke } from '@utils/gifs';
import { Poke } from '#utils/gifs';
class PokeCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder } from 'discord.js';
import { Sad } from '@utils/gifs';
import { Sad } from '#utils/gifs';
class SadCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder } from 'discord.js';
import { Shrug } from '@utils/gifs';
import { Shrug } from '#utils/gifs';
class ShrugCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,9 +19,9 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { User, Message, TextChannel } from 'discord.js';
import IDs from '@utils/ids';
import { addBan, checkActive } from '@utils/database/ban';
import { addEmptyUser, addExistingUser, userExists } from '@utils/database/dbExistingUser';
import IDs from '#utils/ids';
import { addBan, checkActive } from '#utils/database/ban';
import { addEmptyUser, addExistingUser, userExists } from '#utils/database/dbExistingUser';
class BanCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -31,7 +31,7 @@ import {
Snowflake,
} from 'discord.js';
import type { TextChannel } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class DiversityCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -28,16 +28,16 @@ import {
} from 'discord.js';
import type { Message, GuildMember, TextChannel } from 'discord.js';
import { isMessageInstance } from '@sapphire/discord.js-utilities';
import { addExistingUser, userExists } from '@utils/database/dbExistingUser';
import { addExistingUser, userExists } from '#utils/database/dbExistingUser';
import {
addToDatabase,
findNotes,
getNote,
deactivateNote,
deactivateAllNotes,
} from '@utils/database/sus';
import { checkStaff } from '@utils/checker';
import IDs from '@utils/ids';
} from '#utils/database/sus';
import { checkStaff } from '#utils/checker';
import IDs from '#utils/ids';
// TODO add a check when they join the server to give the user the sus role again

View File

@ -24,9 +24,9 @@ import type {
TextChannel,
GuildBan,
} from 'discord.js';
import IDs from '@utils/ids';
import { removeBan, checkActive, addBan } from '@utils/database/ban';
import { addEmptyUser, addExistingUser, userExists } from '@utils/database/dbExistingUser';
import IDs from '#utils/ids';
import { removeBan, checkActive, addBan } from '#utils/database/ban';
import { addEmptyUser, addExistingUser, userExists } from '#utils/database/dbExistingUser';
class UnbanCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class ActivistCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class BookClubCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class ConvincedCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class DebateHostCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class GameNightHostCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class GuestCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class PlusCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class MentorCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class ModCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class RestrictedAccessCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class StageHostCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class TrialVerifierCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class VerifierCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class TrustedCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class VeganCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class VegCuriousCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework';
import type { Message } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class RenameUserCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {

View File

@ -19,7 +19,7 @@
import { InteractionHandler, InteractionHandlerTypes, PieceContext } from '@sapphire/framework';
import type { ButtonInteraction, GuildMember, TextChannel } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class WelcomeButtonHandler extends InteractionHandler {
public constructor(ctx: PieceContext, options: InteractionHandler.Options) {

View File

@ -19,7 +19,7 @@
import { Listener } from '@sapphire/framework';
import type { GuildMember } from 'discord.js';
import { checkActive, getReason } from '@utils/database/ban';
import { checkActive, getReason } from '#utils/database/ban';
class BanJoin extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {

View File

@ -20,8 +20,8 @@
import { Listener } from '@sapphire/framework';
import type { GuildMember } from 'discord.js';
// import { fetchRoles } from '../../utils/database/dbExistingUser';
import IDs from '@utils/ids';
import { blockTime } from '@utils/database/verification';
import IDs from '#utils/ids';
import { blockTime } from '#utils/database/verification';
class VerificationReady extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {

View File

@ -38,12 +38,12 @@ import {
ActionRowBuilder,
EmbedBuilder,
} from 'discord.js';
import { maxVCs, questionInfo, serverFind } from '@utils/verificationConfig';
import { joinVerification, startVerification, finishVerification } from '@utils/database/verification';
import { findNotes } from '@utils/database/sus';
import { userExists, addExistingUser } from '@utils/database/dbExistingUser';
import { rolesToString } from '@utils/formatter';
import IDs from '@utils/ids';
import { maxVCs, questionInfo, serverFind } from '#utils/verificationConfig';
import { joinVerification, startVerification, finishVerification } from '#utils/database/verification';
import { findNotes } from '#utils/database/sus';
import { userExists, addExistingUser } from '#utils/database/dbExistingUser';
import { rolesToString } from '#utils/formatter';
import IDs from '#utils/ids';
class VerificationJoinVCListener extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {

View File

@ -22,11 +22,11 @@ import type {
VoiceState, CategoryChannel, VoiceChannel, TextChannel,
} from 'discord.js';
import { time, ChannelType, PermissionsBitField } from 'discord.js';
import { maxVCs, leaveBan } from '@utils/verificationConfig';
import { getUser, checkFinish, countIncomplete } from '@utils/database/verification';
import { fetchRoles } from '@utils/database/dbExistingUser';
import { fibonacci } from '@utils/mathsSeries';
import IDs from '@utils/ids';
import { maxVCs, leaveBan } from '#utils/verificationConfig';
import { getUser, checkFinish, countIncomplete } from '#utils/database/verification';
import { fetchRoles } from '#utils/database/dbExistingUser';
import { fibonacci } from '#utils/mathsSeries';
import IDs from '#utils/ids';
class VerificationLeaveVCListener extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {

View File

@ -25,7 +25,7 @@ import type {
VoiceChannel,
} from 'discord.js';
import { ChannelType, PermissionsBitField } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class VerificationReady extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {

View File

@ -24,7 +24,7 @@ import type {
Client,
TextChannel,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class VerificationReady extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class CoordinatorOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class DevCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class DiversityCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class EventCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class MentorCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class MentorOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class ModCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class ModOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class PatreonOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class RestrictedAccessOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class VerifierCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -24,7 +24,7 @@ import type {
Message,
GuildMember,
} from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class VerifierOnlyPrecondition extends AllFlowsPrecondition {
public override async messageRun(message: Message) {

View File

@ -20,7 +20,7 @@
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
import { container } from '@sapphire/framework';
import type { TextChannel } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class DiversityMonMessageTask extends ScheduledTask {
public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) {

View File

@ -20,7 +20,7 @@
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
import { container } from '@sapphire/framework';
import type { TextChannel } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class DiversityWedMessageTask extends ScheduledTask {
public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) {

View File

@ -20,7 +20,7 @@
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
import { container } from '@sapphire/framework';
import type { TextChannel } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class RestrictedMessageTask extends ScheduledTask {
public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) {

View File

@ -20,7 +20,7 @@
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
import { container } from '@sapphire/framework';
import type { TextChannel } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class StandupTask extends ScheduledTask {
public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) {

View File

@ -20,7 +20,7 @@
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
import { container } from '@sapphire/framework';
import type { TextChannel } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
class VerifyReminder extends ScheduledTask {
public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) {

View File

@ -18,7 +18,7 @@
*/
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
export class VerifyUnblock extends ScheduledTask {
public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) {

View File

@ -18,7 +18,7 @@
*/
import type { TextChannel } from 'discord.js';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
/**
* Checks if the channel is in the staff category.

View File

@ -19,7 +19,7 @@
import type { GuildMember, GuildMemberRoleManager } from 'discord.js';
import { PrismaClient } from '@prisma/client';
import IDs from '@utils/ids';
import IDs from '#utils/ids';
// Checks if the user exists on the database
export async function userExists(userId: string) {

View File

@ -19,9 +19,9 @@
import type { GuildMember } from 'discord.js';
import { PrismaClient } from '@prisma/client';
import { updateUser } from '@utils/database/dbExistingUser';
import { leaveBan } from '@utils/verificationConfig';
import { fibonacci } from '@utils/mathsSeries';
import { updateUser } from '#utils/database/dbExistingUser';
import { leaveBan } from '#utils/verificationConfig';
import { fibonacci } from '#utils/mathsSeries';
export async function joinVerification(channelId: string, user: GuildMember) {
// Update the user on the database with the current roles they have

View File

@ -17,7 +17,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import devIDs from '@utils/devIDs';
import devIDs from '#utils/devIDs';
// eslint-disable-next-line import/no-mutable-exports
let IDs = {

View File

@ -31,7 +31,7 @@
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": "src", /* Specify the base directory to resolve non-relative module names. */
"paths": {
"@utils/*": ["./utils/*"]
"#utils/*": ["./utils/*"]
}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */