Class: DiscordMessages


DiscordMessages()

new DiscordMessages()


Methods

(async, static) appendMessage(userId, guildId, messages) → {object}

Parameters:
Name Type Description
userId string

Discord user id.

guildId string

Discord guild id.

messages number

Amount of messages to append.

Returns:
  • The user data object.
  • Type: object

(async, static) computeLeaderboard(client, leaderboard, fetchUsersopt) → {*}

Parameters:
Name Type Attributes Default Description
client string

Your Discord.CLient.

leaderboard array

The output from 'fetchLeaderboard' function.

fetchUsers boolean <optional>
false

Wheter to fetch each users position.

Returns:
  • Type: *

(async, static) createUser(userId, guildId) → {object}

Parameters:
Name Type Description
userId string

Discord user id.

guildId string

Discord guild id.

Returns:
  • The user data object.
  • Type: object

(async, static) deleteUser(userId, guildId) → {object}

Parameters:
Name Type Description
userId string

Discord user id.

guildId string

Discord guild id.

Returns:
  • The user data object.
  • Type: object

(async, static) fetch(userId, guildId, fetchPositionopt) → {object}

Parameters:
Name Type Attributes Default Description
userId string

Discord user id.

guildId string

Discord guild id.

fetchPosition boolean <optional>
false

Wheter to fetch the users position.

Returns:
  • The user data object.
  • Type: object

(async, static) fetchLeaderboard(guildId, limit) → {Array}

Parameters:
Name Type Description
guildId string

Discord guild id.

limit number

Amount of maximum enteries to return.

Returns:
  • The leaderboard array.
  • Type: Array

(async, static) resetGuild(guildId) → {boolean}

Parameters:
Name Type Description
guildId string

Discord guild id.

Returns:
  • Return's true if success.
  • Type: boolean

(async, static) setMessages(userId, guildId, messages) → {object}

Parameters:
Name Type Description
userId string

Discord user id.

guildId string

Discord guild id.

messages number

Amount of messages to set.

Returns:
  • The user data object.
  • Type: object

(async, static) setURL(dbUrl) → {Promise}

Parameters:
Name Type Description
dbUrl string

A valid mongo database URI.

Returns:
  • The mongoose connection promise.
  • Type: Promise

(async, static) subtractMessages(userId, guildId, messages) → {object}

Parameters:
Name Type Description
userId string

Discord user id.

guildId string

Discord guild id.

messages number

Amount of messages to subtract.

Returns:
  • The user data object.
  • Type: object