2024-06-14 12:49:26 -04:00
|
|
|
import Message from "./Message.js";
|
2024-06-14 13:06:05 -04:00
|
|
|
import b4a from "b4a";
|
2024-06-14 12:49:26 -04:00
|
|
|
|
|
|
|
class IconMessage extends Message {
|
2024-06-14 15:09:54 -04:00
|
|
|
constructor(peerName, peerAvatar, timestamp) {
|
|
|
|
super("icon", peerName, peerAvatar, null, timestamp);
|
2024-06-14 12:49:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
toJsonString() {
|
|
|
|
return JSON.stringify({
|
|
|
|
...this.toJson()
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
static new(bot, avatarBuffer) {
|
2024-06-14 13:06:05 -04:00
|
|
|
return new IconMessage(bot.botName, b4a.toString(avatarBuffer, 'base64'), Date.now());
|
2024-06-14 12:49:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default IconMessage;
|