Class Card

Class for handling user card

Hierarchy

  • Card

Constructors

  • Card class constructor

    Parameters

    • cardData: {
          cards: {}[];
      } & {}

      Card document by specific user and game

    • chat: Chat

      Chat message instance

    • game: Game

      Game message instance

    Returns Card

Properties

card: {
    cards: {}[];
} & {}

Card document by specific user and game

Type declaration

  • cards: {}[]

Type declaration

    chat: Chat

    Chat message instance

    game: Game

    Game message instance

    Accessors

    • get cards(): string[]
    • Get all cards name from current player

      Returns string[]

    Methods

    • Function for adding new card to the current player or specific card id

      Parameters

      • cardName: string

        Added valid card

      • Optional cardId: number

        Specific card id (optional)

      Returns Promise<void>

    • Function for checking if the user is a winner or not

      Parameters

      • upcomingUserCards: string[]

        Array of cards string

      • notAWinnerCallback: ((__namedParameters) => Promise<void>)

        Callback for handling the game if the card isn't zero

          • (__namedParameters): Promise<void>
          • Parameters

            • __namedParameters: {
                  backCardsImage: MessageMedia;
                  currentCardImage: MessageMedia;
                  frontCardsImage: MessageMedia;
              }
              • backCardsImage: MessageMedia
              • currentCardImage: MessageMedia
              • frontCardsImage: MessageMedia

            Returns Promise<void>

      Returns Promise<void>

      void

    • Function for draw a card for current player

      Returns Promise<void>

    • Function for retrieving user and game specific card

      Parameters

      • player: {}

        Returns Promise<string[]>

        Card document from specific user and current game id

      • Function for checking is player has a specific given card or not

        Parameters

        • card: string

          Valid given card

        Returns boolean

        Boolean that indicate is current player has a card or not

      • Function for removing specific card from current player (E.G get stacked)

        Parameters

        • card: string

          Valid given card

        Returns Promise<void>

      • Function for simplifying send to current person templated message

        Parameters

        • text: string

          Text that will sended

        • currentCardImage: MessageMedia

          A current card image that will sended

        • backCardsImage: MessageMedia

          A back cards image that will sended

        • nextPlayerName: string

          The next player username

        Returns Promise<void>

      • Function for simplifying send to other person templated message

        Parameters

        • firstText: string

          The first text in three message that will sended

        • lastText: string

          The last text in three message that will sended

        • phoneNumber: string

          The specific person phone number

        • currentCardImage: MessageMedia

          A current card image that will sended

        • backOrFrontCardsImage: MessageMedia

          A back or front cards image that will sended

        Returns Promise<void>

      • Function for simplifying send to current other player without current person templated message

        Parameters

        • text: string

          Text that will sended

        • playerList: {}[]

          A list of all players that will get the message

        • currentCardImage: MessageMedia

          A current card image that will sended

        • backCardsImage: MessageMedia

          A back cards image that will sended

        • nextPlayerName: string

          The next player username

        Returns Promise<void>

      • Function that handle user play event.

        Parameters

        • givenCard: allCard

          Valid given card

        Returns Promise<void>

      • Static function for checking a given card is valid or not

        Parameters

        • card: string

          Valid or invalid card string

        Returns boolean

        Boolean that indicate the card is valid or not

      Generated using TypeDoc