Module

FirebaseServices

The firebase services module has firebase related helper functions.

View Source db/firebase/firebase-services.js, line 4

Members

Map.<String, admin.app.App>

# inner constant apps

All the firebase apps in play stored by their name.

View Source db/firebase/firebase-services.js, line 13

Methods

# async inner addUserData(email, types, guildId, memberopt, firstNameopt, lastNameopt)

Adds a new guild member to the guild's member collection. Email is used as ID, there can be no duplicates.
Parameters:
Name Type Attributes Default Description
email String email of member verified
types Array.<String> types this user might verify for
guildId String the guild id
member GuildMember <optional>
{} member verified
firstName String <optional>
'' users first name
lastName String <optional>
'' users last name

View Source db/firebase/firebase-services.js, line 200

# async inner attend(id, guildId) → {Promise.<Array.<String>>}

Attends the user via their discord id
Parameters:
Name Type Description
id String the user's discord snowflake
guildId String the guild id

View Source db/firebase/firebase-services.js, line 269

Error if the email provided was not found.
- the types this user is verified
Promise.<Array.<String>>

# async inner checkEmail(email, guildId) → {Promise.<Array.<Member>>}

Checks to see if the input email matches or is similar to emails in the database Returns an array of objects containing emails that match or are similar, along with the verification status of each, and returns empty array if none match
Parameters:
Name Type Description
email String email to check
guildId String the guild id

View Source db/firebase/firebase-services.js, line 107

- array of members with similar emails to parameter email
Promise.<Array.<Member>>

# async inner getQuestion(guildId) → {Object|null}

Retrieves a question from the db that has not already been asked at the Discord Contests, then marks the question as having been asked in the db.
Parameters:
Name Type Description
guildId String the id of the guild

View Source db/firebase/firebase-services.js, line 55

- the data object of a question or null if no more questions
Object | null

# async inner getReminder(guildId) → {Object|null}

Retrieves self-care reminder from the db that has not already been sent, then marks the reminder as having been asked in the db.
Parameters:
Name Type Description
guildId String the guild id

View Source db/firebase/firebase-services.js, line 76

- the data object of a reminder or null if no more reminders
Object | null

# inner initializeFirebaseAdmin(name, adminSDK, databaseURL)

Will start an admin connection with the given name
Parameters:
Name Type Description
name String name of the connection
adminSDK JSON the JSON file with admin config
databaseURL String the database URL

View Source db/firebase/firebase-services.js, line 22

# async inner verify(email, id, guildId) → {Promise.<Array.<String>>}

Verifies the any event member via their email.
Parameters:
Name Type Description
email String the user email
id String the user's discord snowflake
guildId String the guild id

View Source db/firebase/firebase-services.js, line 232

Error if the email provided was not found.
- the types this user is verified
Promise.<Array.<String>>

Type Definitions

# FirebaseUser

Properties:
Name Type Description
email String
discordId String
types Array.<UserType>

View Source db/firebase/firebase-services.js, line 42

Object

# Member

Properties:
Name Type Description
email String the email of the member
isVerified Boolean whether member has already verified
type String role a member has in the server

View Source db/firebase/firebase-services.js, line 92

# UserType

Properties:
Name Type Description
type String
isVerified Boolean
timestamp Date

View Source db/firebase/firebase-services.js, line 35