Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- uses: actions/setup-node@v6
with:
node-version: 24.x
node-version: 25.x
cache: npm

- run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
"imports": {
"#log": "./src/utils/logger.ts",
"#db": "./src/storage/db/db.ts",
"#*": "./src/*"
"#/*": "./src/*"
},
"trustedDependencies": [
"@biomejs/biome",
"lefthook"
],
"engines": {
"node": ">=25.6.0"
"node": ">=25.6.1"
}
}
40 changes: 20 additions & 20 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import { GatewayIntentBits, Partials, Client } from "discord.js";
import * as sentry from "@sentry/node";

import { readConfig, databasePath, args } from "#service/config.ts";
import { readConfig, databasePath, args } from "#/service/config.ts";
import log from "#log";

import { Temporal } from "@js-temporal/polyfill";
import "#polyfills.ts";
import "#/polyfills.ts";

import * as kysely from "#storage/db/db.ts";
import * as kysely from "#/storage/db/db.ts";

import type { ReactionHandler } from "#handler/ReactionHandler.ts";
import messageDeleteHandler from "#handler/messageDeleteHandler.ts";
import { woisVoteReactionHandler } from "#commands/woisvote.ts";
import * as voiceStateService from "#service/voiceState.ts";
import type { ReactionHandler } from "#/handler/ReactionHandler.ts";
import messageDeleteHandler from "#/handler/messageDeleteHandler.ts";
import { woisVoteReactionHandler } from "#/commands/woisvote.ts";
import * as voiceStateService from "#/service/voiceState.ts";

import roleAssignerHandler from "#handler/reaction/roleAssignerHandler.ts";
import pollReactionHandler from "#handler/reaction/pollReactionHandler.ts";
import logEmotesReactionHandler from "#handler/reaction/logEmotesReactionHandler.ts";
import quoteReactionHandler from "#handler/reaction/quoteHandler.ts";
import roleAssignerHandler from "#/handler/reaction/roleAssignerHandler.ts";
import pollReactionHandler from "#/handler/reaction/pollReactionHandler.ts";
import logEmotesReactionHandler from "#/handler/reaction/logEmotesReactionHandler.ts";
import quoteReactionHandler from "#/handler/reaction/quoteHandler.ts";

import {
handleInteractionEvent,
loadCommands,
messageCommandHandler,
registerAllApplicationCommandsAsGuildCommands,
} from "#handler/commandHandler.ts";
import * as guildMemberHandler from "#handler/guildMemberHandler.ts";
import deleteThreadMessagesHandler from "#handler/messageCreate/deleteThreadMessagesHandler.ts";
import { handlePresenceUpdate } from "#handler/presenceHandler.ts";
import { createBotContext, type BotContext } from "#context.ts";
import { ehreReactionHandler } from "#commands/ehre.ts";
import * as terminal from "#utils/terminal.ts";
import * as dateUtils from "#utils/dateUtils.ts";
import * as cronService from "#service/cron.ts";
} from "#/handler/commandHandler.ts";
import * as guildMemberHandler from "#/handler/guildMemberHandler.ts";
import deleteThreadMessagesHandler from "#/handler/messageCreate/deleteThreadMessagesHandler.ts";
import { handlePresenceUpdate } from "#/handler/presenceHandler.ts";
import { createBotContext, type BotContext } from "#/context.ts";
import { ehreReactionHandler } from "#/commands/ehre.ts";
import * as terminal from "#/utils/terminal.ts";
import * as dateUtils from "#/utils/dateUtils.ts";
import * as cronService from "#/service/cron.ts";

const env = process.env;

Expand Down
4 changes: 2 additions & 2 deletions src/commands/aoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
} from "discord.js";
import type * as discord from "discord.js";

import type { BotContext } from "#context.ts";
import type { ApplicationCommand } from "#commands/command.ts";
import type { BotContext } from "#/context.ts";
import type { ApplicationCommand } from "#/commands/command.ts";

import log from "#log";

Expand Down
6 changes: 3 additions & 3 deletions src/commands/autoEhre.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ProcessableMessage } from "#service/command.ts";
import type { SpecialCommand } from "#commands/command.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { SpecialCommand } from "#/commands/command.ts";

import * as ehreService from "#service/ehre.ts";
import * as ehreService from "#/service/ehre.ts";

export default class AutoEhreCommand implements SpecialCommand {
name = "AutoEhre";
Expand Down
8 changes: 4 additions & 4 deletions src/commands/banlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
time,
} from "discord.js";

import type { ApplicationCommand } from "#commands/command.ts";
import type { BotContext } from "#context.ts";
import type { Ban } from "#storage/db/model.ts";
import type { ApplicationCommand } from "#/commands/command.ts";
import type { BotContext } from "#/context.ts";
import type { Ban } from "#/storage/db/model.ts";

import * as banService from "#service/ban.ts";
import * as banService from "#/service/ban.ts";
import log from "#log";

export default class BanListCommand implements ApplicationCommand {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/bonk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as fs from "node:fs/promises";
import { createCanvas, loadImage } from "@napi-rs/canvas";
import type { GuildMember } from "discord.js";

import type { MessageCommand } from "#commands/command.ts";
import type { ProcessableMessage } from "#service/command.ts";
import type { MessageCommand } from "#/commands/command.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import log from "#log";

const createBonkMeme = async (author: GuildMember): Promise<Buffer> => {
Expand Down
10 changes: 5 additions & 5 deletions src/commands/boobs.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { time, TimestampStyles, type User } from "discord.js";

import type { ProcessableMessage } from "#service/command.ts";
import type { MessageCommand } from "#commands/command.ts";
import type { Boob } from "#storage/db/model.ts";
import * as boob from "#storage/boob.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { MessageCommand } from "#/commands/command.ts";
import type { Boob } from "#/storage/db/model.ts";
import * as boob from "#/storage/boob.ts";
import log from "#log";
import { randomEntry } from "#service/random.ts";
import { randomEntry } from "#/service/random.ts";

interface Booba {
description: string;
Expand Down
6 changes: 3 additions & 3 deletions src/commands/clap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
SlashCommandStringOption,
} from "discord.js";

import type { BotContext } from "#context.ts";
import type { ProcessableMessage } from "#service/command.ts";
import type { ApplicationCommand, MessageCommand } from "#commands/command.ts";
import type { BotContext } from "#/context.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { ApplicationCommand, MessageCommand } from "#/commands/command.ts";

const clapify = (str: string): string => `${str.split(/\s+/).join(" :clap: ")} :clap:`;

Expand Down
4 changes: 2 additions & 2 deletions src/commands/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type {
SlashCommandBuilder,
} from "discord.js";

import type { ProcessableMessage } from "#service/command.ts";
import type { BotContext } from "#context.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { BotContext } from "#/context.ts";

export type Command = ApplicationCommand | AutocompleteCommand | MessageCommand | SpecialCommand;

Expand Down
10 changes: 5 additions & 5 deletions src/commands/dadJoke.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { cleanContent } from "discord.js";

import type { ProcessableMessage } from "#service/command.ts";
import type { SpecialCommand } from "#commands/command.ts";
import type { BotContext } from "#context.ts";
import { substringAfter } from "#utils/stringUtils.ts";
import { randomEntry } from "#service/random.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { SpecialCommand } from "#/commands/command.ts";
import type { BotContext } from "#/context.ts";
import { substringAfter } from "#/utils/stringUtils.ts";
import { randomEntry } from "#/service/random.ts";

type Lang = "german" | "austrian";

Expand Down
8 changes: 4 additions & 4 deletions src/commands/deoida.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { BotContext } from "#context.ts";
import type { ProcessableMessage } from "#service/command.ts";
import type { MessageCommand } from "#commands/command.ts";
import * as austrianTranslation from "#storage/austrianTranslation.ts";
import type { BotContext } from "#/context.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { MessageCommand } from "#/commands/command.ts";
import * as austrianTranslation from "#/storage/austrianTranslation.ts";

async function deOidaLine(line: string): Promise<string> {
// We cannot just split all words using \s*. That could tear apart words or translations like "fescher bub"
Expand Down
6 changes: 3 additions & 3 deletions src/commands/doener.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BotContext } from "#context.ts";
import type { ProcessableMessage } from "#service/command.ts";
import type { MessageCommand } from "#commands/command.ts";
import type { BotContext } from "#/context.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { MessageCommand } from "#/commands/command.ts";

const prices = {
kebab: 5.5,
Expand Down
10 changes: 5 additions & 5 deletions src/commands/download-video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
MessageFlags,
} from "discord.js";

import type { BotContext } from "#context.ts";
import type { ApplicationCommand } from "#commands/command.ts";
import * as ytDlService from "#service/ytDl.ts";
import assertNever from "#utils/assertNever.ts";
import TempDir from "#utils/TempDir.ts";
import type { BotContext } from "#/context.ts";
import type { ApplicationCommand } from "#/commands/command.ts";
import * as ytDlService from "#/service/ytDl.ts";
import assertNever from "#/utils/assertNever.ts";
import TempDir from "#/utils/TempDir.ts";

export default class DownloadVideoCommand implements ApplicationCommand {
name = "Download Video"; // Must be upper case, because this name will be matched against the application command name
Expand Down
10 changes: 5 additions & 5 deletions src/commands/ehre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import {
userMention,
} from "discord.js";

import type { ApplicationCommand } from "#commands/command.ts";
import type { BotContext } from "#context.ts";
import type { EhrePoints } from "#storage/db/model.ts";
import type { ReactionHandler } from "#handler/ReactionHandler.ts";
import type { ApplicationCommand } from "#/commands/command.ts";
import type { BotContext } from "#/context.ts";
import type { EhrePoints } from "#/storage/db/model.ts";
import type { ReactionHandler } from "#/handler/ReactionHandler.ts";

import * as ehreService from "#service/ehre.ts";
import * as ehreService from "#/service/ehre.ts";

function createUserPointString(e: EhrePoints) {
return `${userMention(e.userId)}: ${ehreService.formatPoints(e.points)}`;
Expand Down
10 changes: 5 additions & 5 deletions src/commands/emote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
type AutocompleteInteraction,
} from "discord.js";

import type { ApplicationCommand, AutocompleteCommand } from "#commands/command.ts";
import type { BotContext } from "#context.ts";
import type { Emote } from "#storage/db/model.ts";
import * as emoteLoggingService from "#service/emoteLogging.ts";
import { formatDateTime } from "#utils/dateUtils.ts";
import type { ApplicationCommand, AutocompleteCommand } from "#/commands/command.ts";
import type { BotContext } from "#/context.ts";
import type { Emote } from "#/storage/db/model.ts";
import * as emoteLoggingService from "#/service/emoteLogging.ts";
import { formatDateTime } from "#/utils/dateUtils.ts";

function buildSingleEmoteResponse(
emote: Emote,
Expand Down
10 changes: 5 additions & 5 deletions src/commands/emoteLogger.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ProcessableMessage } from "#service/command.ts";
import type { SpecialCommand } from "#commands/command.ts";
import type { BotContext } from "#context.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { SpecialCommand } from "#/commands/command.ts";
import type { BotContext } from "#/context.ts";

import * as emoteService from "#service/emote.ts";
import * as emoteLoggingService from "#service/emoteLogging.ts";
import * as emoteService from "#/service/emote.ts";
import * as emoteLoggingService from "#/service/emoteLogging.ts";

export default class EmoteLoggerCommand implements SpecialCommand {
name = "EmoteLogger";
Expand Down
4 changes: 2 additions & 2 deletions src/commands/emoteSender.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Message } from "discord.js";

import type { BotContext } from "#context.ts";
import type { SpecialCommand } from "#commands/command.ts";
import type { BotContext } from "#/context.ts";
import type { SpecialCommand } from "#/commands/command.ts";
import log from "#log";

export default class EmoteSenderCommand implements SpecialCommand {
Expand Down
14 changes: 7 additions & 7 deletions src/commands/erinnerung.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import {
import * as chrono from "chrono-node";
import * as sentry from "@sentry/node";

import type { MessageCommand, ApplicationCommand } from "#commands/command.ts";
import type { BotContext } from "#context.ts";
import type { Reminder } from "#storage/db/model.ts";
import type { ProcessableMessage } from "#service/command.ts";
import type { MessageCommand, ApplicationCommand } from "#/commands/command.ts";
import type { BotContext } from "#/context.ts";
import type { Reminder } from "#/storage/db/model.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import log from "#log";
import * as reminderService from "#storage/reminders.ts";
import * as dateUtils from "#utils/dateUtils.ts";
import * as reminderService from "#/storage/reminders.ts";
import * as dateUtils from "#/utils/dateUtils.ts";

import { ensureChatInputCommand } from "#utils/interactionUtils.ts";
import { ensureChatInputCommand } from "#/utils/interactionUtils.ts";

const validateDate = (date: Date): true | string => {
if (!dateUtils.isValidDate(date)) {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/erleuchtung.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { SlashCommandBuilder } from "discord.js";
import type { CommandInteraction, CacheType } from "discord.js";

import type { ApplicationCommand, MessageCommand } from "#commands/command.ts";
import type { ProcessableMessage } from "#service/command.ts";
import type { ApplicationCommand, MessageCommand } from "#/commands/command.ts";
import type { ProcessableMessage } from "#/service/command.ts";

import * as erleuchtungService from "#service/erleuchtung.ts";
import * as erleuchtungService from "#/service/erleuchtung.ts";

export default class ErleuchtungCommand implements MessageCommand, ApplicationCommand {
name = "erleuchtung";
Expand Down
4 changes: 2 additions & 2 deletions src/commands/error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MessageCommand } from "./command.ts";
import type { ProcessableMessage } from "#service/command.ts";
import type { BotContext } from "#context.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { BotContext } from "#/context.ts";

export default class ErrorCommand implements MessageCommand {
name = "feler";
Expand Down
20 changes: 10 additions & 10 deletions src/commands/extend.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ActionRowBuilder, ComponentType, type Message, StringSelectMenuBuilder } from "discord.js";

import type { MessageCommand } from "#commands/command.ts";
import type { BotContext } from "#context.ts";
import type { ProcessableMessage } from "#service/command.ts";
import type { Poll } from "#storage/db/model.ts";

import * as pollEmbedService from "#service/pollEmbed.ts";
import { parseLegacyMessageParts } from "#service/command.ts";
import * as pollService from "#service/poll.ts";
import { defer } from "#utils/interactionUtils.ts";
import { truncateToLength } from "#utils/stringUtils.ts";
import type { MessageCommand } from "#/commands/command.ts";
import type { BotContext } from "#/context.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import type { Poll } from "#/storage/db/model.ts";

import * as pollEmbedService from "#/service/pollEmbed.ts";
import { parseLegacyMessageParts } from "#/service/command.ts";
import * as pollService from "#/service/poll.ts";
import { defer } from "#/utils/interactionUtils.ts";
import { truncateToLength } from "#/utils/stringUtils.ts";

export default class ExtendCommand implements MessageCommand {
name = "extend";
Expand Down
8 changes: 4 additions & 4 deletions src/commands/faulenzerping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import {
userMention,
} from "discord.js";

import type { BotContext } from "#context.ts";
import type { ApplicationCommand } from "#commands/command.ts";
import { chunkArray } from "#utils/arrayUtils.ts";
import * as time from "#utils/time.ts";
import type { BotContext } from "#/context.ts";
import type { ApplicationCommand } from "#/commands/command.ts";
import { chunkArray } from "#/utils/arrayUtils.ts";
import * as time from "#/utils/time.ts";

export default class FaulenzerPingCommand implements ApplicationCommand {
name = "Faulenzerping"; // Must be upper case, because this name will be matched against the application command name
Expand Down
6 changes: 3 additions & 3 deletions src/commands/ficktabelle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MessageCommand } from "#commands/command.ts";
import type { ProcessableMessage } from "#service/command.ts";
import { randomEntry } from "#service/random.ts";
import type { MessageCommand } from "#/commands/command.ts";
import type { ProcessableMessage } from "#/service/command.ts";
import { randomEntry } from "#/service/random.ts";

const FICKTABELLE_URL =
"https://cdn.discordapp.com/attachments/620721921767505942/636149543154614272/20160901-164533-Kovrtep-id1487186.png";
Expand Down
Loading