add interfaces

This commit is contained in:
mightypanders 2023-04-18 23:44:31 +02:00
parent c28b37b0e9
commit 4ae5989fd5

View File

@ -1,29 +1,35 @@
import { Collection } from "@discordjs/collection"
import { Role } from "discord.js"
export type Maybe<T> = T | undefined export type Maybe<T> = T | undefined
export interface Player { export interface Player {
name: string name: string
} }
export type supported_languages = "german" | "english" export type supported_languages = "german" | "english"
export interface localized_string { export interface localized_string {
[k: string]: { [k: string]: {
[k in supported_languages]: string [k in supported_languages]: string
} }
} }
export class CustomError extends Error { export class CustomError extends Error {
private code: string private code: string
public constructor(message: string, errorCode: string) { public constructor(message: string, errorCode: string) {
super(message) super(message)
this.code = errorCode this.code = errorCode
} }
public getCode() { return this.code } public getCode() { return this.code }
} }
export const errorCodes = { export const errorCodes = {
no_end_date: 'no_end_date', no_end_date: 'no_end_date',
no_string_present: 'no_string_present', no_string_present: 'no_string_present',
no_schedule: 'no_schedule', no_schedule: 'no_schedule',
schedule_not_supported: 'schedule_not_supported', schedule_not_supported: 'schedule_not_supported',
no_repetition_amount: 'no_repetition_amount', no_repetition_amount: 'no_repetition_amount',
invalid_repetition_string: 'invalid_repetition_string', invalid_repetition_string: 'invalid_repetition_string',
no_creator_id: "no_creator_id", no_creator_id: "no_creator_id",
} }
export interface ChangedRoles {
addedRoles: Collection<string, Role>
removedRoles: Collection<string, Role>
}
export type PermissionLevel = "VIEWER" | "ADMIN"