MCPcopy Create free account
hub / github.com/MathMan05/Fermi / generateMessage

Method generateMessage

src/webpage/message.ts:708–1465  ·  view source on GitHub ↗
(
		premessage?: Message | undefined,
		ignoredblock = false,
		dupe: false | HTMLDivElement = false,
	)

Source from the content-addressed store, hash-verified

706 interaction: messagejson["interaction"];
707 get ephemeral() {
708 return !!(this.flags & (1 << 6));
709 }
710 getWelcomeText() {
711 const messages = I18n.welcomeMessages("|||").split("\n");
712 const message = messages[Number(BigInt(this.id) % BigInt(messages.length))];
713 return message.split("|||") as [string, string];
714 }
715 generateMessage(
716 premessage?: Message | undefined,
717 ignoredblock = false,
718 dupe: false | HTMLDivElement = false,
719 ) {
720 const div = dupe || this.div;
721 if (!div) return;
722 if (div === this.div) {
723 this.div.classList.add("messagediv");
724 }
725 if (this.type === 21) {
726 this.channel.parent?.getmessage(this.message_reference?.message_id as string).then((_) => {
727 const gen = _?.generateMessage(undefined, undefined, div);
728 if (!gen) {
729 //idk
730 }
731 });
732 return div;
733 }
734
735 const editmode = this.channel.editing === this;
736 if (!premessage && !dupe) {
737 premessage = this.channel.messages.get(this.channel.idToPrev.get(this.id) as string);
738 }
739 if (
740 this.mentionsuser(this.localuser.user) ||
741 this.ephemeral ||
742 this.interaction?.user.id === this.localuser.user.id
743 ) {
744 div.classList.add("mentioned");
745 }
746 div.style.setProperty(
747 "--time-text",
748 JSON.stringify(
749 new Date(this.getUnixTime()).toLocaleTimeString([], {hour: "2-digit", minute: "2-digit"}),
750 ),
751 );
752
753 if (this === this.channel.replyingto) {
754 div.classList.add("replying");
755 }
756 div.innerHTML = "";
757 const build = document.createElement("div");
758
759 build.classList.add("flexltr", "message");
760
761 if (this.interaction) {
762 const replyline = document.createElement("div");
763
764 const minipfp = document.createElement("img");
765 minipfp.classList.add("replypfp");

Callers 10

setEditMethod · 0.95
giveDataMethod · 0.95
blockedPropigateMethod · 0.95
buildhtmlMethod · 0.95
blockMethod · 0.80
unblockMethod · 0.80
deleteEventMethod · 0.80
lastreadmessageidMethod · 0.80
readStateInfoMethod · 0.80
readbottomMethod · 0.80

Calls 15

mentionsuserMethod · 0.95
getUnixTimeMethod · 0.95
getpfpsrcMethod · 0.95
subNameMethod · 0.95
bindMethod · 0.95
addEventMethod · 0.95
makeHTMLMethod · 0.95
editMethod · 0.95
giveBoxMethod · 0.95
showMethod · 0.95
bindButtonEventMethod · 0.95
updateReactionsMethod · 0.95

Tested by

no test coverage detected