Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EmojiCache

Cache responsible for storing emoji related data

Hierarchy

Index

Methods

addToIndex

  • addToIndex(id: string, objectId?: string): Promise<void>
  • Add ids to the index of a namespace

    Parameters

    • id: string

      ids to add

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<void>

bindGuild

  • Bind a guild id to the cache

    Parameters

    • guildId: string

      id of the guild that should be bound to this cache

    Returns EmojiCache

bindObject

  • bindObject(boundObject: Partial<EmojiData>): void
  • Bind an object to the cache instance, you can read more on binding on the landing page of the documentation

    Parameters

    • boundObject: Partial<EmojiData>

      Object to bind to this cache instance

    Returns void

buildId

  • buildId(emojiId: string, guildId?: string): string
  • Build a unique key to store the emoji in the datasource

    Parameters

    • emojiId: string

      id of the emoji (this does not refer to the name of the emoji)

    • Optional guildId: string

      id of the guild this emoji belongs to

    Returns string

    prepared key

filter

  • filter(fn: (emoji?: EmojiData, index?: number, array?: EmojiData[]) => unknown, guildId: undefined | string, ids?: string[]): Promise<EmojiCache[]>
  • Filter for emojis by providing a filter function which returns true upon success and false otherwise

    Parameters

    • fn: (emoji?: EmojiData, index?: number, array?: EmojiData[]) => unknown

      filter function to use for the filtering

        • (emoji?: EmojiData, index?: number, array?: EmojiData[]): unknown
        • Parameters

          • Optional emoji: EmojiData
          • Optional index: number
          • Optional array: EmojiData[]

          Returns unknown

    • guildId: undefined | string

      id of the guild the emojis searched belong to

    • Optional ids: string[]

    Returns Promise<EmojiCache[]>

    array of bound emoji caches

find

  • find(fn: (emoji?: EmojiData, index?: number, array?: string[]) => unknown, guildId: string, ids: undefined | string[]): Promise<null | EmojiCache>
  • Find an emoji by providing a filter function which returns true upon success and false otherwise

    Parameters

    • fn: (emoji?: EmojiData, index?: number, array?: string[]) => unknown

      filter function to use for filtering for a single emoji

        • (emoji?: EmojiData, index?: number, array?: string[]): unknown
        • Parameters

          • Optional emoji: EmojiData
          • Optional index: number
          • Optional array: string[]

          Returns unknown

    • guildId: string

      id of the guild the emojis searched belong to

    • ids: undefined | string[]

    Returns Promise<null | EmojiCache>

    bound emoji cache

get

  • Get an emoji via id

    Parameters

    • id: string

      id of the emoji (this does not refer to the name of the emoji)

    • guildId: undefined | string = ...

      id of the guild this emoji belongs to

    Returns Promise<null | EmojiCache>

    EmojiCache with bound object or null if nothing was found

getIndexCount

  • getIndexCount(objectId?: string): Promise<number>
  • Get the number of elements that are within an index

    Parameters

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<number>

getIndexMembers

  • getIndexMembers(objectId?: string): Promise<string[]>
  • Get all members from an index

    Parameters

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<string[]>

isIndexed

  • isIndexed(id: string, objectId?: string): Promise<boolean>
  • Check if an id is a member of an index

    Parameters

    • id: string

      id to check

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<boolean>

    returns true if it is a part of the index, false otherwise

remove

  • remove(id: string, guildId?: undefined | string): Promise<void>
  • Remove an emoji from the cache

    Parameters

    • id: string

      id of the emoji (this does not refer to the name of the emoji)

    • guildId: undefined | string = ...

      id of the guild this emoji belongs to

    Returns Promise<void>

removeFromIndex

  • removeFromIndex(id: string, objectId?: string): Promise<void>
  • Remove an id from the index

    Parameters

    • id: string

      id to be removed

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<void>

removeIndex

  • removeIndex(objectId?: string): Promise<void>
  • Delete an index

    Parameters

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<void>

structurize

  • structurize<D>(data: Partial<D>): Partial<D>
  • Delete keys from data if necessary based on RainCache structureDefs options and return the cleaned data

    Type parameters

    • D

    Parameters

    • data: Partial<D>

      The data to possibly delete object entries from

    Returns Partial<D>

update

  • update(id: string, guildId?: undefined | string, data: Partial<EmojiData>): Promise<EmojiCache>
  • Update a emoji

    Parameters

    • id: string

      id of the emoji (this does not refer to the name of the emoji)

    • guildId: undefined | string = ...

      id of the guild this emoji belongs to

    • data: Partial<EmojiData>

      new data of the emoji, that will get merged with the old data

    Returns Promise<EmojiCache>

    returns a bound EmojiCache

Properties

Optional boundGuild

boundGuild?: string

guild id bound to this cache

boundObject

boundObject: null | Partial<EmojiData> = null

dataTimestamp

dataTimestamp: null | Date = null

namespace

namespace: "emoji" = "emoji"

rain

rain: RainCache<any, any>

storageEngine

storageEngine: BaseStorageEngine<EmojiData>

Constructors

constructor

  • Create a new EmojiCache

    This class is automatically instantiated by RainCache

    Parameters

    • storageEngine: BaseStorageEngine<EmojiData>

      storage engine to use for this cache

    • rain: RainCache<any, any>
    • Optional boundObject: Partial<EmojiData>

      Optional, may be used to bind an emoji object to the cache

    Returns EmojiCache

Generated using TypeDoc