diff --git a/server/helper/role.controller.ts b/server/helper/role.controller.ts new file mode 100644 index 0000000..63903cd --- /dev/null +++ b/server/helper/role.controller.ts @@ -0,0 +1,25 @@ +import { Role, User } from "discord.js"; +import { ExtendedClient } from "../structures/client"; + +export default class RoleController { + + constructor(private client: ExtendedClient) { } + private getMediaRoleForGuild(guildId: string): Role { + throw new Error("Method not implemented."); + } + public addRoleToUser(user: User, role: Role, guildId: string, requestId: string) { + throw new Error("Method not implemented."); + } + private removeRoleFromUser(user: User, roleToAdd: any, guildId: string, requestId: string) { + throw new Error("Method not implemented."); + } + + public addMediaRoleToUser(user: User, guildId: string, requestId: string) { + const roleToAdd: Role = this.getMediaRoleForGuild(guildId) + return this.addRoleToUser(user, roleToAdd, guildId, requestId) + } + public removeMediaRoleFromUser(user: User, guildId: string, requestId: string) { + const roleToRemove: Role = this.getMediaRoleForGuild(guildId) + return this.removeRoleFromUser(user, roleToRemove, guildId, requestId) + } +} diff --git a/server/structures/client.ts b/server/structures/client.ts index caaad67..a3ccfcb 100644 --- a/server/structures/client.ts +++ b/server/structures/client.ts @@ -11,6 +11,7 @@ import { CommandType } from "../types/commandTypes"; import { isInitialAnnouncement } from "../helper/messageIdentifiers"; import VoteController from "../helper/vote.controller"; import { yavinJellyfinHandler } from "../.."; +import RoleController from "../helper/role.controller"; @@ -19,6 +20,7 @@ export class ExtendedClient extends Client { private commandFilePath = `${__dirname}/../commands` private jellyfin: JellyfinHandler public voteController: VoteController = new VoteController(this, yavinJellyfinHandler) + public roleController: RoleController = new RoleController(this) public commands: Collection = new Collection() private announcementChannels: Collection = new Collection() //guildId to TextChannel private announcementRoleHandlerTask: Collection = new Collection() //one task per guild