Skip to main content

Active Hours Utility Module Spec

Methods

fetchActiveHoursFromDB(guildId)

(async) fetchActiveHoursFromDB(guildId) → {Promise.<{start_time: string, end_time: string}>}

Fetches active operating hours for a guild from the database.

Parameters:
NameTypeDescription
guildIdstringThe ID of the Discord guild.
Returns:
  • A promise that resolves to an object containing start_time and end_time representing the active operating hours for the guild.

    Type: Promise.<{start_time: string, end_time: string}>

storeOperatingHours(guildId, startTime, endTime)

(async) storeOperatingHours(guildId, startTime, endTime) → {Promise.<void>}

Stores or updates operating hours for a guild in the database.

Parameters:
NameTypeDescription
guildIdstringThe ID of the Discord guild.
startTimestringThe start time of the operating hours.
endTimestringThe end time of the operating hours.
Returns:
  • A Promise that resolves when the operating hours are successfully stored or updated.

    Type: Promise<void>

getRandomHourWithinActiveHours(activeHoursData)

getRandomHourWithinActiveHours(activeHoursData) → {string}

Generates a random hour within the active operating hours for a guild.

Parameters:
NameTypeDescription
activeHoursDataObjectAn object containing start_time and end_time.
Returns:
  • A formatted string representing a random hour within the active hours.

    Type: string