Class Kmail

Properties

date: Date
id: number
rawMessage: string
senderId: number
senderName: string
type: "normal" | "giftshop"

Accessors

  • get insideNote(): null | string
  • Get the note on the inside of the gift

    Returns null | string

    Note on the inside of the gift

  • get message(): string
  • Get message contents without any HTML from items or meat

    Returns string

    Cleaned message contents

  • get outsideNote(): string
  • Get the note on the outside of the gift. If the kmail is not a gift, this will be the entire message.

    Returns string

    Note on the outside of the gift, or the entire message for non-gifts

Methods

  • Delete the kmail

    Returns boolean

    Whether the kmail was deleted

  • Get items attached to the inside of the gift

    Returns Map<Item, number>

    Map of items attached to the kmail and their quantities

  • Get items attached to the kmail

    Returns Map<Item, number>

    Map of items attached to the kmail and their quantities

  • Get meat attached to the kmail

    Returns number

    Meat attached to the kmail

  • Get items attached to the outside of the gift, which should be just the gift wrapper for giftshop items, and all items for normal kmails

    Returns Map<Item, number>

    Map of items attached to the kmail and their quantities

  • Reply to kmail

    Parameters

    • message: string = ""

      Message with which to reply

    • items: Item[] | Map<Item, number> = []

      Items to send

    • meat: number = 0

      Meat to send

    Returns boolean

    True if the kmail was successfully sent

    Kmail.send

  • Bulk delete kmails

    Parameters

    • kmails: Kmail[]

      Kmails to delete

    Returns number

    Number of kmails deleted

  • Sends a gift to a player

    Sends multiple kmails if more than 3 unique item types are attached. Ignores any ungiftable items.

    Parameters

    • to: string | number

      The player name or id to receive the gift

    • message: string = ""

      Message to send

    • items: Item[] | Map<Item, number> = []

      The items to be attached

    • meat: number = 0

      The quantity of meat to be attached

    • insideNote: string = ""

      The note on the inside of the gift

    Returns boolean

    True if the gift was successfully sent

  • Returns all of the player's kmails

    Parameters

    • count: number = 100

      Number of kmails to fetch

    Returns Kmail[]

    Parsed kmails

  • Parses a kmail from KoL's native format

    Parameters

    • rawKmail: RawKmail

      Kmail in the format supplies by api.php

    Returns Kmail

    Parsed kmail

  • Sends a kmail to a player

    Sends multiple kmails if more than 11 unique item types are attached. Ignores any ungiftable items. Sends a gift package to players in run

    Parameters

    • to: string | number

      The player name or id to receive the kmail

    • message: string = ""

      The text contents of the message

    • items: Item[] | Map<Item, number> = []

      The items to be attached

    • meat: number = 0

      The quantity of meat to be attached

    Returns boolean

    True if the kmail was successfully sent