V2 of AttendingServer. Represents 1 server that this YABOB is a member of

  • Public functions can be accessed by the command handler
  • Variables with an underscore has a public getter, but only mutable inside the class

Hierarchy

  • AttendingServerV2

Constructors

Properties

_activeHelpers: Collection<string, Helper> = ...

unique active helpers, key is member.id

_afterSessionMessage: string = ''

message sent to students after they leave

_loggingChannel?: TextChannel

optional, channel where yabob will log message. if undefined, don't log on the server

_queues: Collection<string, HelpQueueV2> = ...

Key is CategoryChannel.id of the parent catgory of #queue

guild: Guild
queueChannelsCache: QueueChannel[] = []

cached result of getQueueChannels

serverExtensions: IServerExtension[]
timers: Collection<"SERVER_PERIODIC_UPDATE", Timer | Timeout> = ...

Keeps track of all the setTimout/setIntervals we started

user: User

Accessors

Methods

  • Send an announcement to all the students in the helper's approved queues

    Parameters

    • helperMember: GuildMember

      helper that used /announce

    • announcement: string

      announcement body

    • Optional targetQueue: QueueChannel

      optional, specifies which queue to announce to

    Returns Promise<void>

  • Closes all the queue that the helper has permission to & logs the help time to console

    Throws

    ServerError: If the helper is not hosting

    Parameters

    • helperMember: GuildMember

      helper that used /stop

    Returns Promise<Required<Helper>>

  • Creates a new OH queue

    Throws

    ServerError: if a queue with the same name already exists

    Parameters

    • newQueueName: string

      name for this class/queue

    Returns Promise<void>

  • Deletes a queue by categoryID

    Throws

    ServerError: If a discord API failure happened

    • #queue existence is checked by CentralCommandHandler

    Parameters

    • queueCategoryID: string

      CategoryChannel.id of the target queue

    Returns Promise<void>

  • Dequeue the student that has been waiting for the longest

    Throws

    • ServerError: if specificQueue is given but helper doesn't have the role
    • QueueError: if the queue to dequeue from rejects

    Parameters

    • helperMember: GuildMember

      the helper that used /next

      • ignored if specified queue is undefined

    Returns Promise<Readonly<Helpee>>

  • Handle /next with arguments

    Parameters

    • helperMember: GuildMember
    • Optional targetStudentMember: GuildMember

      if specified, remove this student and override queue order

    • Optional specificQueue: QueueChannel

      if specified, dequeue from this queue

    Returns Promise<Readonly<Helpee>>

  • Gets all the queue channels on the server. SLOW if nothing is found, returns empty array

    Parameters

    • useCache: boolean = true

      whether to read from existing cache, defaults to true

      • unless queues change often, prefer cache for fast response

    Returns Promise<QueueChannel[]>

  • Called when a member joins a voice channel

    • triggers onStudentJoinVC for all extensions if the member is a student and was just removed from the queue

    Parameters

    • member: GuildMember
    • newVoiceState: WithRequired<VoiceState, "channel">

    Returns Promise<void>

  • Called when a member leaves a voice channel

    • triggers onStudentLeaveVC for all extensions if the member is a student and was in a session

    Parameters

    • member: GuildMember
    • oldVoiceState: WithRequired<VoiceState, "channel">

    Returns Promise<void>

  • Opens all the queue that the helper has permission to

    Throws

    ServerError

    • If the helper doesn't have any class roles
    • If the helper is already hosting

    Parameters

    • helperMember: GuildMember

      helper that used /start

    • notify: boolean

    Returns Promise<void>

  • Removes a student from a given queue

    Throws

    QueueError: if

    Parameters

    • studentMember: GuildMember

      student that used /leave or the cleave button

    • targetQueue: QueueChannel

      the queue to leave from

    Returns Promise<void>

  • Overwrites the existing command help channel and send new help messages

    Parameters

    • helpCategories: CategoryChannel[]

      the category named 'Bot Commands Help'

    • messageContents: {
          channelName: string;
          file: HelpMessage[];
          visibility: string[];
      }[]

      array of embeds to send to each help channel

    Returns Promise<void>

  • Sets the after sesseion message for this server

    Parameters

    • newMessage: string

      after session message to set

      • Side Effect: Triggers a firebase backup

    Returns Promise<void>

  • Sets the logging channel for this server

    Parameters

    • Optional loggingChannel: TextChannel

      the new logging channel.

      • If undefined, disables logging for this server

    Returns Promise<void>

  • Sets up queue auto clear for this server

    Parameters

    • hours: number

      the number of hours to wait before clearing the queue

    • minutes: number

      the number of minutes to wait before clearing the queue

    • enable: boolean

      whether to disable auto clear, overrides 'hours'

    Returns Promise<void>

  • Sets the serious server flag, and updates the queues if changing from serious to not serious, or vice versa

    Returns

    True if triggered renders for all queues

    Parameters

    • enableSeriousMode: boolean

      new value for seriousServer

    Returns Promise<boolean>

Generated using TypeDoc