adds support for role settings and various fixes
This commit is contained in:
parent
96b2dbb21c
commit
8fe0c9f46b
20 changed files with 1199 additions and 183 deletions
|
@ -41,15 +41,6 @@ class Message {
|
|||
Message.contextmenu.addbutton("Copy message id", function () {
|
||||
navigator.clipboard.writeText(this.id);
|
||||
});
|
||||
Message.contextmenu.addbutton("Copy user id", function () {
|
||||
navigator.clipboard.writeText(this.author.id);
|
||||
});
|
||||
Message.contextmenu.addbutton("Message user", function () {
|
||||
fetch(this.info.api.toString() + "/v9/users/@me/channels", { method: "POST",
|
||||
body: JSON.stringify({ "recipients": [this.author.id] }),
|
||||
headers: this.headers
|
||||
});
|
||||
});
|
||||
Message.contextmenu.addbutton("Edit", function () {
|
||||
this.channel.editing = this;
|
||||
document.getElementById("typebox").value = this.content;
|
||||
|
@ -174,25 +165,26 @@ class Message {
|
|||
replyline.appendChild(username);
|
||||
const reply = document.createElement("div");
|
||||
username.classList.add("username");
|
||||
Member.resolve(this.author, this.guild).then(_ => {
|
||||
if (!_) {
|
||||
return;
|
||||
}
|
||||
;
|
||||
this.author.bind(username, this.guild);
|
||||
/*
|
||||
Member.resolve(this.author,this.guild).then(_=>{
|
||||
if(!_) {return};
|
||||
console.log(_.error);
|
||||
if (_.error) {
|
||||
username.textContent += "Error";
|
||||
alert("Should've gotten here");
|
||||
const error = document.createElement("span");
|
||||
error.textContent = "!";
|
||||
if(_.error){
|
||||
username.textContent+="Error";
|
||||
alert("Should've gotten here")
|
||||
const error=document.createElement("span");
|
||||
error.textContent="!";
|
||||
error.classList.add("membererror");
|
||||
username.after(error);
|
||||
|
||||
return;
|
||||
}
|
||||
username.style.color = _.getColor();
|
||||
}).catch(_ => {
|
||||
console.log(_);
|
||||
username.style.color=_.getColor();
|
||||
}).catch(_=>{
|
||||
console.log(_)
|
||||
});
|
||||
*/
|
||||
reply.classList.add("replytext");
|
||||
replyline.appendChild(reply);
|
||||
const line2 = document.createElement("hr");
|
||||
|
@ -204,9 +196,9 @@ class Message {
|
|||
const author = message.author;
|
||||
reply.appendChild(markdown(message.content, { stdsize: true }));
|
||||
minipfp.src = author.getpfpsrc();
|
||||
author.profileclick(minipfp);
|
||||
author.bind(minipfp);
|
||||
username.textContent = author.username;
|
||||
author.profileclick(username);
|
||||
author.bind(username);
|
||||
});
|
||||
div.appendChild(replyline);
|
||||
}
|
||||
|
@ -227,7 +219,7 @@ class Message {
|
|||
const combine = (premessage?.author?.id != this.author.id) || (current) || this.message_reference;
|
||||
if (combine) {
|
||||
const pfp = this.author.buildpfp();
|
||||
this.author.profileclick(pfp);
|
||||
this.author.bind(pfp);
|
||||
pfpRow.appendChild(pfp);
|
||||
}
|
||||
else {
|
||||
|
@ -242,21 +234,7 @@ class Message {
|
|||
if (combine) {
|
||||
const username = document.createElement("span");
|
||||
username.classList.add("username");
|
||||
this.author.profileclick(username);
|
||||
Member.resolve(this.author, this.guild).then(_ => {
|
||||
if (!_) {
|
||||
return;
|
||||
}
|
||||
;
|
||||
if (_.error) {
|
||||
const error = document.createElement("span");
|
||||
error.textContent = "!";
|
||||
error.classList.add("membererror");
|
||||
username.after(error);
|
||||
return;
|
||||
}
|
||||
username.style.color = _.getColor();
|
||||
});
|
||||
this.author.bind(username, this.guild);
|
||||
username.textContent = this.author.username;
|
||||
const userwrap = document.createElement("tr");
|
||||
userwrap.appendChild(username);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue