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

Method viewReactions

src/webpage/message.ts:312–358  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310 viewReactions() {
311 const dio = new Dialog(I18n.message.reactionsTitle());
312 const div = document.createElement("div");
313 div.classList.add("flexltr");
314 const reactions = document.createElement("div");
315 reactions.classList.add("flexttb", "reactionList");
316
317 const list = document.createElement("div");
318 list.classList.add("flexttb", "reactionUserList");
319 let curSelect = document.createElement("div");
320 reactions.append(
321 ...this.reactions.map((reaction) => {
322 const button = document.createElement("div");
323
324 console.log(reaction);
325 const emoji = new Emoji(reaction.emoji, this.guild);
326 button.append(emoji.getHTML(), `(${reaction.count})`);
327 let users: User[] | undefined = undefined;
328 button.onclick = async () => {
329 curSelect.classList.remove("current");
330
331 curSelect = button;
332 curSelect.classList.add("current");
333 if (!users) {
334 const f = await fetch(
335 `${this.info.api}/channels/${this.channel.id}/messages/${this.id}/reactions/${reaction.emoji.name}?limit=50&type=0`,
336 {headers: this.headers},
337 );
338 users = ((await f.json()) as userjson[]).map((_) => new User(_, this.localuser));
339 }
340 list.innerHTML = "";
341 list.append(
342 ...users.map((user) => {
343 return user.createWidget(this.guild);
344 }),
345 );
346 };
347
348 return button;
349 }),
350 );
351 //@ts-ignore
352 [...reactions.children][0].click();
353 div.append(reactions, list);
354 dio.options.addHTMLArea(div);
355 dio.show();
356 }
357
358 setEdit() {
359 const prev = this.channel.editing;
360 this.channel.editing = this;
361 if (prev) prev.generateMessage();

Callers 1

setupcmenuMethod · 0.95

Calls 6

getHTMLMethod · 0.95
showMethod · 0.95
addMethod · 0.80
createWidgetMethod · 0.80
removeMethod · 0.45
addHTMLAreaMethod · 0.45

Tested by

no test coverage detected