This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
role.ts
60 lines (59 loc) · 2.29 KB
/
role.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { CategoryChannel, Role } from "discord.js";
/**
* A class to store course role data, including a veteran role and data on course attributes
*/
export class CourseRole {
/** Prefix for course, examples: CSC, CIS, SOC */
prefix: string;
/** Number for course, examples: 101, 300, 325 */
number: string;
/** Name of course, optional, automatically generated based on prefix and number if omitted */
name: string;
/** Role for active students */
role: Role;
/** Role for students that have passed through a class, should be able to access archives */
veteranRole: Role;
/** Whether or not the course requires video information */
video: Boolean;
/** A course to share a category with this course, bi-directional (both classes point to each other) */
jointClass: string | undefined;
/** Keeps track of the category associated with this class */
category: CategoryChannel;
/**
* @constructor
* @param {{ prefix: string, number: string, role: Role, veteranRole: Role, video: boolean, jointClass: string}} options Set of options for course data
*/
constructor({ prefix, number, role, veteranRole, video = false, jointClass = undefined, name = undefined }: { prefix: string; number: string; role: Role; veteranRole: Role; video?: Boolean; jointClass?: string; name?: string; }) {
this.prefix = prefix;
this.number = number;
this.name = prefix + '-' + number;
if (name) this.name = name;
this.role = role;
this.veteranRole = veteranRole;
if (video) this.video = video;
else this.video = false;
this.jointClass = jointClass;
}
}
/**
* A class to handle optional roles, includes a description that is displayed to students
*/
export class OptionalRole {
/** Holds name of optional role */
name: string;
/** A description of what the role signifies, displayed to students when selecting */
description: string;
/** Associated role to be assigned */
role: Role;
/**
* @constructor
* @param {string} name Name for optional role
* @param {string} description Description to be displayed to students
* @param {import('discord.js').Role} role object associated with course
*/
constructor(name: string, role: Role, description: string = undefined) {
this.name = name;
this.description = description;
this.role = role;
}
}