Adds eslint and linted & improved routing for interactions

This commit is contained in:
Michel Fedde 2025-06-17 20:37:53 +02:00
parent 83209f642c
commit 441715675c
35 changed files with 2091 additions and 463 deletions

View file

@ -4,7 +4,7 @@ export class ElementCreatedEvent<T extends Model = Model> {
constructor(
public readonly tableName: string,
public readonly instanceValues: Partial<T>,
public readonly instanceId: number
public readonly instanceId: number|bigint
) {
}
}

View file

@ -1,6 +1,5 @@
import cron from "node-cron";
import {Nullable} from "../types/Nullable";
import {Class, ClassNamed} from "../types/Class";
import {Class} from "../types/Class";
export type EventConfiguration = {
name: string,

View file

@ -1,12 +1,10 @@
import {ElementCreatedEvent} from "../ElementCreatedEvent";
import {DefaultHandler} from "../DefaultEvents";
import {PlaydateModel} from "../../Models/PlaydateModel";
import PlaydateTableConfiguration from "../../Database/tables/Playdate";
import {EmbedBuilder, roleMention, time} from "discord.js";
import {ArrayUtils} from "../../Utilities/ArrayUtils";
import {GroupConfigurationHandler} from "../../Groups/GroupConfigurationHandler";
import {Container} from "../../Container/Container";
import {GroupConfigurationRenderer} from "../../Groups/GroupConfigurationRenderer";
import {GroupConfigurationRepository} from "../../Repositories/GroupConfigurationRepository";
import {DiscordClient} from "../../Discord/DiscordClient";
@ -37,7 +35,7 @@ export async function sendCreatedNotificationEventHandler(event: ElementCreatedE
return;
}
const channel = await Container.get<DiscordClient>(DiscordClient.name).Client.channels.fetch(targetChannel)
const channel = await Container.get<DiscordClient>(DiscordClient.name).Client.channels.fetch(<string>targetChannel)
if (!channel) {
return;
}

View file

@ -1,13 +1,12 @@
import {CronExpression, Event, EventConfiguration, TimedEvent} from "./EventHandler";
import {EventConfiguration, TimedEvent} from "./EventHandler";
import {Container} from "../Container/Container";
import Playdate from "../Database/tables/Playdate";
import {PlaydateRepository} from "../Repositories/PlaydateRepository";
import {GroupConfigurationHandler} from "../Groups/GroupConfigurationHandler";
import {GroupConfigurationRepository} from "../Repositories/GroupConfigurationRepository";
import {PlaydateModel} from "../Models/PlaydateModel";
import {ChannelId} from "../types/DiscordTypes";
import {DiscordClient} from "../Discord/DiscordClient";
import {EmbedBuilder, MessageFlags, roleMention, time} from "discord.js";
import {EmbedBuilder, roleMention, time} from "discord.js";
import {ArrayUtils} from "../Utilities/ArrayUtils";
export class ReminderEvent implements TimedEvent {
@ -27,9 +26,9 @@ export class ReminderEvent implements TimedEvent {
name: "Reminders",
}
cronExpression: CronExpression = "0 9 * * *"
cronExpression: string = "0 9 * * *"
private groupConfigurationRepository: GroupConfigurationRepository
private readonly groupConfigurationRepository: GroupConfigurationRepository
private playdateRepository: PlaydateRepository
private discordClient: DiscordClient
@ -72,13 +71,13 @@ export class ReminderEvent implements TimedEvent {
return Promise.resolve();
}
return this.sendReminder(playdate, targetChannel, config.locale);
return this.sendReminder(playdate, targetChannel);
}, this)
await Promise.all(promises);
}
private async sendReminder(playdate: PlaydateModel, targetChannel: ChannelId, locale: Intl.Locale) {
private async sendReminder(playdate: PlaydateModel, targetChannel: ChannelId) {
if (!playdate.group) {
return;
}