The firebase services module has firebase related helper functions.
Members
Map.<String, admin.app.App>
# inner constant apps
All the firebase apps in play stored by their name.
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 |
# 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 |
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 |
- 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 |
- 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 |
- 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 |
# 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 |
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> |
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 |