Constructor
new Guild(client, data)
Parameters:
Name | Type | Description |
---|---|---|
client | Discord. | The Discord Client. |
data | GuildData | The data to create the guild with. |
- Source
Members
achievements :AchievementManager
- The manager for the achievements.
Type:
- Source
guildId :Discord.Snowflake
- The ID of the guild.
Type:
- Discord.
Snowflake
- Source
guildName :string
- The name of the guild.
Type:
- string
- Source
ranks :RankManager
- The manager for the ranks.
Type:
- Source
users :UserManager
- The manager for the users.
Type:
- Source
Methods
(async) appendAchievement(achievement) → {Promise.<Achievement>}
Add an achievement to the guild data and update it the database.
Parameters:
Name | Type | Description |
---|---|---|
achievement | AchievementBuilder | The achievement to add. |
- Source
Throws:
- - If the achievement is missing.
- Type
- MissingValue
- - If the achievement is not an AchievementBuilder instance.
- Type
- InvalidValue
- - If the achievement name is already in use.
- Type
- DuplicateAchievement
Returns:
- The achievement added.
- Type:
- Promise.<Achievement>
(async) appendRank(rank) → {Promise.<Rank>}
Add a rank to the guild data and update it the database.
Parameters:
Name | Type | Description |
---|---|---|
rank | RankBuilder | The rank to add. |
- Source
Throws:
- - If the rank is missing.
- Type
- MissingValue
- - If the rank is not a RankBuilder instance.
- Type
- InvalidValue
- - If the rank priority is already in use.
- Type
- RankPriorityInUse
Returns:
- The rank added.
- Type:
- Promise.<Rank>
(async) removeAchievement(name) → {Promise.<Achievement>}
Remove an achievement from the guild data and update it the database. **NOTE: When an achievement is removed, it is removed from all users.**
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the achievement to remove. |
- Source
Returns:
- The achievement removed.
- Type:
- Promise.<Achievement>
(async) removeRank(priority) → {Promise.<Rank>}
Remove a rank from the guild data and update it the database.
Parameters:
Name | Type | Description |
---|---|---|
priority | Number | The priority of the rank to remove. |
- Source
Returns:
- The rank removed.
- Type:
- Promise.<Rank>
toJSON() → {GuildData}
Convert the guild data to a JSON object used for saving to the database.
- Source
Returns:
- Type:
- GuildData