jellyfin-discord-bot/server/interfaces.ts

49 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-04-18 23:44:31 +02:00
import { Collection } from "@discordjs/collection"
import { GuildScheduledEvent, Role, TextChannel } from "discord.js"
2023-04-15 22:06:35 +02:00
2023-04-20 20:54:07 +02:00
export type Maybe<T> = T | undefined | null
2023-04-15 22:06:35 +02:00
export interface Player {
2023-06-24 21:05:43 +02:00
name: string
2023-04-15 22:06:35 +02:00
}
export type supported_languages = "german" | "english"
export interface localized_string {
2023-06-24 21:05:43 +02:00
[k: string]: {
[k in supported_languages]: string
}
2023-04-15 22:06:35 +02:00
}
export class CustomError extends Error {
2023-06-24 21:05:43 +02:00
private code: string
public constructor(message: string, errorCode: string) {
super(message)
this.code = errorCode
}
public getCode() { return this.code }
2023-04-15 22:06:35 +02:00
}
export const errorCodes = {
2023-06-24 21:05:43 +02:00
no_end_date: 'no_end_date',
no_string_present: 'no_string_present',
no_schedule: 'no_schedule',
schedule_not_supported: 'schedule_not_supported',
no_repetition_amount: 'no_repetition_amount',
invalid_repetition_string: 'invalid_repetition_string',
no_creator_id: "no_creator_id",
2023-04-18 23:44:31 +02:00
}
export interface ChangedRoles {
2023-06-24 21:05:43 +02:00
addedRoles: Collection<string, Role>
removedRoles: Collection<string, Role>
2023-04-15 22:06:35 +02:00
}
2023-06-15 22:33:22 +02:00
export interface JellyfinConfig {
2023-06-24 21:05:43 +02:00
jellyfinUrl: string,
jellyfinToken: string,
movieCollectionId: string,
collectionUser: string
2023-06-15 22:33:22 +02:00
}
export type PermissionLevel = "VIEWER" | "ADMIN" | "TEMPORARY"
export interface voteMessageInputInformation {
movies: string[],
startDate: Date,
event: GuildScheduledEvent,
announcementChannel: TextChannel,
pinAfterSending: boolean,
}