import "core-js/stable/atob"; import { Item } from "kolmafia"; type RawKmail = { id: string; type: string; fromid: string; azunixtime: string; message: string; fromname: string; localtime: string; }; export default class Kmail { readonly id: number; readonly date: Date; readonly type: "normal" | "giftshop"; readonly senderId: number; readonly senderName: string; readonly rawMessage: string; private _parsedMessageParts; /** * Parses a kmail from KoL's native format * * @param rawKmail Kmail in the format supplies by api.php * @returns Parsed kmail */ static parse(rawKmail: RawKmail): Kmail; /** * Returns all of the player's kmails * * @param count Number of kmails to fetch * @returns Parsed kmails */ static inbox(count?: number): Kmail[]; /** * Bulk delete kmails * * @param kmails Kmails to delete * @returns Number of kmails deleted */ static delete(kmails: Kmail[]): number; private static _genericSend; /** * 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 * * @param to The player name or id to receive the kmail * @param message The text contents of the message * @param items The items to be attached * @param meat The quantity of meat to be attached * @returns True if the kmail was successfully sent */ static send(to: string | number, message?: string, items?: Map | Item[], meat?: number): boolean; /** * Sends a gift to a player * * Sends multiple kmails if more than 3 unique item types are attached. * Ignores any ungiftable items. * * @param to The player name or id to receive the gift * @param message Message to send * @param items The items to be attached * @param meat The quantity of meat to be attached * @param insideNote The note on the inside of the gift * @returns True if the gift was successfully sent */ static gift(to: string | number, message?: string, items?: Map | Item[], meat?: number, insideNote?: string): boolean; private constructor(); /** * Delete the kmail * * @returns Whether the kmail was deleted */ delete(): boolean; private get _messageParts(); private _parseMessageParts; /** * Get message contents without any HTML from items or meat * * @returns Cleaned message contents */ get message(): string; /** * Get the note on the outside of the gift. If the kmail is not a gift, * this will be the entire message. * * @returns Note on the outside of the gift, or the entire message for non-gifts */ get outsideNote(): string; /** * Get the note on the inside of the gift * * @returns Note on the inside of the gift */ get insideNote(): string | null; /** * Get items attached to the kmail * * @returns Map of items attached to the kmail and their quantities */ items(): Map; /** * 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 of items attached to the kmail and their quantities */ outsideItems(): Map; /** * Get items attached to the inside of the gift * * @returns Map of items attached to the kmail and their quantities */ insideItems(): Map; /** * Get meat attached to the kmail * * @returns Meat attached to the kmail */ meat(): number; /** * Reply to kmail * * @param message Message with which to reply * @param items Items to send * @param meat Meat to send * @see Kmail.send * @returns True if the kmail was successfully sent */ reply(message?: string, items?: Map | Item[], meat?: number): boolean; } export {};