LinkUp-Bot-Lib/src/message/IconMessage.ts
2024-06-16 12:19:18 +03:00

34 lines
946 B
TypeScript

/**
* @module Message
*/
import {Message} from "./Message";
import b4a from "b4a";
import {Client} from "../Client";
export class IconMessage extends Message {
/**
* @description Creates a new icon message.
* @since 1.0
* @author MiTask
* @constructor
* @param peerName Peer username
* @param peerAvatar Peer avatar URL
* @param timestamp UNIX Timestamp
*/
constructor(peerName: string, peerAvatar: string, timestamp: number) {
super("icon", peerName, peerAvatar, null, timestamp);
}
/**
* @description Creates a new icon message instance.
* @since 1.0
* @author MiTask
* @param bot Bot Client class
* @param avatarBuffer Bot Avatar buffer
* @returns IconMessage instance
*/
static new(bot: Client, avatarBuffer: Buffer): IconMessage {
return new IconMessage(bot.botName, b4a.toString(avatarBuffer, 'base64'), Date.now());
}
}