Various changes cleaning up how user data is stored
This commit is contained in:
parent
618cbf6167
commit
3ed09d615d
7 changed files with 163 additions and 50 deletions
|
@ -22,11 +22,14 @@ class channel{
|
||||||
},null,_=>{return _.isAdmin()});
|
},null,_=>{return _.isAdmin()});
|
||||||
}
|
}
|
||||||
constructor(JSON,owner){
|
constructor(JSON,owner){
|
||||||
|
|
||||||
if(JSON===-1){
|
if(JSON===-1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.type=JSON.type;
|
this.type=JSON.type;
|
||||||
this.owner=owner;
|
this.owner=owner;
|
||||||
|
this.headers=this.owner.headers;
|
||||||
|
console.log(this.headers)
|
||||||
this.messages=[];
|
this.messages=[];
|
||||||
this.name=JSON.name;
|
this.name=JSON.name;
|
||||||
this.id=JSON.id;
|
this.id=JSON.id;
|
||||||
|
@ -216,7 +219,7 @@ class channel{
|
||||||
}
|
}
|
||||||
fetch(info.api.toString()+"/v9/channels/"+this.id+"/messages/"+this.lastmessageid+"/ack",{
|
fetch(info.api.toString()+"/v9/channels/"+this.id+"/messages/"+this.lastmessageid+"/ack",{
|
||||||
method:"POST",
|
method:"POST",
|
||||||
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
|
headers:this.headers,
|
||||||
body:JSON.stringify({})
|
body:JSON.stringify({})
|
||||||
});
|
});
|
||||||
this.lastreadmessageid=this.lastmessageid;
|
this.lastreadmessageid=this.lastmessageid;
|
||||||
|
@ -286,7 +289,7 @@ class channel{
|
||||||
createChannel(name,type){
|
createChannel(name,type){
|
||||||
fetch(info.api.toString()+"/guilds/"+this.owner.id+"/channels",{
|
fetch(info.api.toString()+"/guilds/"+this.owner.id+"/channels",{
|
||||||
method:"Post",
|
method:"Post",
|
||||||
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
|
headers:this.headers,
|
||||||
body:JSON.stringify({
|
body:JSON.stringify({
|
||||||
name: name,
|
name: name,
|
||||||
type: type,
|
type: type,
|
||||||
|
@ -310,7 +313,7 @@ class channel{
|
||||||
["button","","submit",function(){
|
["button","","submit",function(){
|
||||||
fetch(info.api.toString()+"/v9/channels/"+thisid,{
|
fetch(info.api.toString()+"/v9/channels/"+thisid,{
|
||||||
method:"PATCH",
|
method:"PATCH",
|
||||||
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
|
headers:this.headers,
|
||||||
body:JSON.stringify({
|
body:JSON.stringify({
|
||||||
"name": name,
|
"name": name,
|
||||||
"type": thistype,
|
"type": thistype,
|
||||||
|
@ -334,7 +337,7 @@ class channel{
|
||||||
deleteChannel(){
|
deleteChannel(){
|
||||||
fetch(info.api.toString()+"/v9/channels/"+this.id,{
|
fetch(info.api.toString()+"/v9/channels/"+this.id,{
|
||||||
method:"DELETE",
|
method:"DELETE",
|
||||||
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token}
|
headers:this.headers
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
getHTML(){
|
getHTML(){
|
||||||
|
@ -348,13 +351,13 @@ class channel{
|
||||||
const out=this;
|
const out=this;
|
||||||
fetch(info.api.toString()+"/channels/"+this.id+"/messages?limit=100",{
|
fetch(info.api.toString()+"/channels/"+this.id+"/messages?limit=100",{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {Authorization:token},
|
headers: this.headers,
|
||||||
}).then((j)=>{return j.json()}).then(function(responce){
|
}).then((j)=>{return j.json()}).then(responce=>{
|
||||||
messages.innerHTML = '';
|
messages.innerHTML = '';
|
||||||
//responce.reverse()
|
//responce.reverse()
|
||||||
messagelist=[];
|
messagelist=[];
|
||||||
for(const thing of responce){
|
for(const thing of responce){
|
||||||
const messager=new cmessage(thing)
|
const messager=new cmessage(thing,this)
|
||||||
if(out.messageids[messager.id]==undefined){
|
if(out.messageids[messager.id]==undefined){
|
||||||
out.messageids[messager.id]=messager;
|
out.messageids[messager.id]=messager;
|
||||||
out.messages.push(messager);
|
out.messages.push(messager);
|
||||||
|
@ -391,12 +394,12 @@ class channel{
|
||||||
for(const i in responce){
|
for(const i in responce){
|
||||||
let messager
|
let messager
|
||||||
if(!next){
|
if(!next){
|
||||||
messager=new cmessage(responce[i])
|
messager=new cmessage(responce[i],this)
|
||||||
}else{
|
}else{
|
||||||
messager=next;
|
messager=next;
|
||||||
}
|
}
|
||||||
if(responce[+i+1]!==undefined){
|
if(responce[+i+1]!==undefined){
|
||||||
next=new cmessage(responce[+i+1]);
|
next=new cmessage(responce[+i+1],this);
|
||||||
}else{
|
}else{
|
||||||
next=undefined;
|
next=undefined;
|
||||||
console.log("ohno",+i+1)
|
console.log("ohno",+i+1)
|
||||||
|
@ -450,7 +453,7 @@ class channel{
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
messageCreate(messagep,focus){
|
messageCreate(messagep,focus){
|
||||||
const messagez=new cmessage(messagep.d);
|
const messagez=new cmessage(messagep.d,this);
|
||||||
this.lastmessageid=messagez.id;
|
this.lastmessageid=messagez.id;
|
||||||
if(messagez.author===this.owner.owner.user){
|
if(messagez.author===this.owner.owner.user){
|
||||||
this.lastreadmessageid=messagez.id;
|
this.lastreadmessageid=messagez.id;
|
||||||
|
|
|
@ -3,6 +3,7 @@ class dirrect extends guild{
|
||||||
super(-1);
|
super(-1);
|
||||||
console.log(JSON);
|
console.log(JSON);
|
||||||
this.owner=owner;
|
this.owner=owner;
|
||||||
|
this.headers={"Content-type": "application/json; charset=UTF-8",Authorization:this.owner.userinfo.token};
|
||||||
if(!this.owner){
|
if(!this.owner){
|
||||||
console.error("Owner was not included, please fix")
|
console.error("Owner was not included, please fix")
|
||||||
}
|
}
|
||||||
|
@ -56,6 +57,7 @@ class group extends channel{
|
||||||
constructor(JSON,owner){
|
constructor(JSON,owner){
|
||||||
super(-1);
|
super(-1);
|
||||||
this.owner=owner;
|
this.owner=owner;
|
||||||
|
this.headers=this.owner.headers;
|
||||||
this.messages=[];
|
this.messages=[];
|
||||||
console.log(JSON.recipients,JSON)
|
console.log(JSON.recipients,JSON)
|
||||||
this.name=JSON.recipients[0]?.username;
|
this.name=JSON.recipients[0]?.username;
|
||||||
|
|
|
@ -26,11 +26,13 @@ class guild{
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
constructor(JSON,owner){
|
constructor(JSON,owner){
|
||||||
|
|
||||||
if(JSON===-1){
|
if(JSON===-1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(JSON);
|
console.log(JSON);
|
||||||
this.owner=owner;
|
this.owner=owner;
|
||||||
|
this.headers={"Content-type": "application/json; charset=UTF-8",Authorization:this.owner.userinfo.token};
|
||||||
if(!this.owner){
|
if(!this.owner){
|
||||||
console.error("Owner was not included, please fix")
|
console.error("Owner was not included, please fix")
|
||||||
}
|
}
|
||||||
|
@ -103,14 +105,14 @@ class guild{
|
||||||
console.log(build,thing)
|
console.log(build,thing)
|
||||||
fetch(info.api.toString()+"/v9/guilds/"+this.id+"/channels",{
|
fetch(info.api.toString()+"/v9/guilds/"+this.id+"/channels",{
|
||||||
method:"PATCH",
|
method:"PATCH",
|
||||||
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
|
headers:this.headers,
|
||||||
body:JSON.stringify([thing])
|
body:JSON.stringify([thing])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
fetch(info.api.toString()+"/v9/guilds/"+this.id+"/channels",{
|
fetch(info.api.toString()+"/v9/guilds/"+this.id+"/channels",{
|
||||||
method:"PATCH",
|
method:"PATCH",
|
||||||
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
|
headers:this.headers,
|
||||||
body:JSON.stringify(build)
|
body:JSON.stringify(build)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -171,7 +173,7 @@ class guild{
|
||||||
this.unreads();
|
this.unreads();
|
||||||
fetch(info.api.toString()+"/v9/read-states/ack-bulk",{
|
fetch(info.api.toString()+"/v9/read-states/ack-bulk",{
|
||||||
method:"POST",
|
method:"POST",
|
||||||
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
|
headers:this.headers,
|
||||||
body:JSON.stringify(build)
|
body:JSON.stringify(build)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -260,7 +262,7 @@ class guild{
|
||||||
createChannel(name,type){
|
createChannel(name,type){
|
||||||
fetch(info.api.toString()+"/guilds/"+this.id+"/channels",{
|
fetch(info.api.toString()+"/guilds/"+this.id+"/channels",{
|
||||||
method:"Post",
|
method:"Post",
|
||||||
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
|
headers:this.headers,
|
||||||
body:JSON.stringify({name: name, type: type})
|
body:JSON.stringify({name: name, type: type})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
const info=JSON.parse(localStorage.getItem("instanceinfo"));
|
|
||||||
info.api=new URL(info.api);
|
|
||||||
info.cdn=new URL(info.cdn);
|
|
||||||
info.gateway=new URL(info.gateway);
|
|
||||||
info.wellknown=new URL(info.wellknown);
|
|
||||||
function setDynamicHeight() {
|
function setDynamicHeight() {
|
||||||
var servertdHeight = document.getElementById('servertd').offsetHeight+document.getElementById('typebox').offsetHeight+document.getElementById('pasteimage').offsetHeight;
|
var servertdHeight = document.getElementById('servertd').offsetHeight+document.getElementById('typebox').offsetHeight+document.getElementById('pasteimage').offsetHeight;
|
||||||
document.documentElement.style.setProperty('--servertd-height', servertdHeight + 'px');
|
document.documentElement.style.setProperty('--servertd-height', servertdHeight + 'px');
|
||||||
|
@ -15,12 +10,24 @@ resizeObserver.observe(document.getElementById('typebox'));
|
||||||
resizeObserver.observe(document.getElementById('pasteimage'));
|
resizeObserver.observe(document.getElementById('pasteimage'));
|
||||||
setDynamicHeight();
|
setDynamicHeight();
|
||||||
|
|
||||||
|
const users=getBulkUsers();
|
||||||
let token=gettoken();
|
if(!users.currentuser){
|
||||||
let ws
|
window.location.href = '/login.html';
|
||||||
//initwebsocket();
|
}
|
||||||
|
const info=users.users[users.currentuser].serverurls;
|
||||||
|
console.log(users)
|
||||||
|
let token=users.users[users.currentuser].token;
|
||||||
let READY;
|
let READY;
|
||||||
|
|
||||||
|
let thisuser=new localuser({token:token});
|
||||||
|
thisuser.initwebsocket().then(_=>{
|
||||||
|
thisuser.loaduser();
|
||||||
|
thisuser.init();
|
||||||
|
document.getElementById("loading").classList.add("doneloading");
|
||||||
|
document.getElementById("loading").classList.remove("loading");
|
||||||
|
console.log("done loading")
|
||||||
|
});
|
||||||
|
|
||||||
var currentmenu="";
|
var currentmenu="";
|
||||||
document.addEventListener('click', function(event) {
|
document.addEventListener('click', function(event) {
|
||||||
if(currentmenu==""){
|
if(currentmenu==""){
|
||||||
|
@ -259,11 +266,10 @@ async function enter(event){
|
||||||
let packets=1;
|
let packets=1;
|
||||||
let serverz=0;
|
let serverz=0;
|
||||||
let serverid=[];
|
let serverid=[];
|
||||||
let thisuser=null;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
thisuser=new localuser();
|
|
||||||
let cchanel=0;
|
let cchanel=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class localuser{
|
class localuser{
|
||||||
constructor(){
|
constructor(userinfo){
|
||||||
this.initwebsocket();
|
this.token=userinfo.token;
|
||||||
|
this.userinfo=userinfo;
|
||||||
this.initialized=false;
|
this.initialized=false;
|
||||||
}
|
}
|
||||||
gottenReady(ready){
|
gottenReady(ready){
|
||||||
|
@ -38,14 +39,31 @@ class localuser{
|
||||||
}
|
}
|
||||||
this.typing=[];
|
this.typing=[];
|
||||||
}
|
}
|
||||||
initwebsocket(){
|
outoffocus(){
|
||||||
|
document.getElementById("servers").textContent="";
|
||||||
|
document.getElementById("channels").textContent="";
|
||||||
|
document.getElementById("messages").textContent="";
|
||||||
|
this.lookingguild=null;
|
||||||
|
this.channelfocus=null;
|
||||||
|
}
|
||||||
|
unload(){
|
||||||
|
this.initialized=false;
|
||||||
|
clearInterval(this.wsinterval);
|
||||||
|
this.outoffocus();
|
||||||
|
this.guilds=[];
|
||||||
|
this.guildids={};
|
||||||
|
this.ws.close(4000)
|
||||||
|
}
|
||||||
|
async initwebsocket(){
|
||||||
|
let returny=null
|
||||||
|
const promise=new Promise((res)=>{returny=res});
|
||||||
this.ws = new WebSocket(info.gateway.toString());
|
this.ws = new WebSocket(info.gateway.toString());
|
||||||
this.ws.addEventListener('open', (event) => {
|
this.ws.addEventListener('open', (event) => {
|
||||||
console.log('WebSocket connected');
|
console.log('WebSocket connected');
|
||||||
this.ws.send(JSON.stringify({
|
this.ws.send(JSON.stringify({
|
||||||
"op": 2,
|
"op": 2,
|
||||||
"d": {
|
"d": {
|
||||||
"token":token,
|
"token":this.token,
|
||||||
"capabilities": 16381,
|
"capabilities": 16381,
|
||||||
"properties": {
|
"properties": {
|
||||||
"browser": "Jank Client",
|
"browser": "Jank Client",
|
||||||
|
@ -79,12 +97,9 @@ class localuser{
|
||||||
break;
|
break;
|
||||||
case "READY":
|
case "READY":
|
||||||
this.gottenReady(temp);
|
this.gottenReady(temp);
|
||||||
this.loaduser();
|
|
||||||
READY=temp;
|
READY=temp;
|
||||||
this.init();
|
|
||||||
genusersettings();
|
genusersettings();
|
||||||
document.getElementById("loading").classList.add("doneloading");
|
returny();
|
||||||
document.getElementById("loading").classList.remove("loading")
|
|
||||||
break;
|
break;
|
||||||
case "MESSAGE_UPDATE":
|
case "MESSAGE_UPDATE":
|
||||||
if(this.initialized){
|
if(this.initialized){
|
||||||
|
@ -135,7 +150,7 @@ class localuser{
|
||||||
|
|
||||||
}else if(temp.op===10){
|
}else if(temp.op===10){
|
||||||
console.log("heartbeat down")
|
console.log("heartbeat down")
|
||||||
setInterval(_=>{
|
this.wsinterval=setInterval(_=>{
|
||||||
this.ws.send(JSON.stringify({op:1,d:packets}))
|
this.ws.send(JSON.stringify({op:1,d:packets}))
|
||||||
},temp.d.heartbeat_interval)
|
},temp.d.heartbeat_interval)
|
||||||
packets=1;
|
packets=1;
|
||||||
|
@ -149,8 +164,24 @@ class localuser{
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ws.addEventListener('close', (event) => {
|
this.ws.addEventListener('close', (event) => {
|
||||||
console.log('WebSocket closed');
|
clearInterval(this.wsinterval);
|
||||||
|
console.log('WebSocket closed');
|
||||||
|
console.warn(event);
|
||||||
|
if(event.code!==4000&&thisuser===this){
|
||||||
|
this.unload();
|
||||||
|
document.getElementById("loading").classList.remove("doneloading");
|
||||||
|
document.getElementById("loading").classList.add("loading");
|
||||||
|
this.initwebsocket().then(_=>{
|
||||||
|
thisuser.loaduser();
|
||||||
|
thisuser.init();
|
||||||
|
document.getElementById("loading").classList.add("doneloading");
|
||||||
|
document.getElementById("loading").classList.remove("loading");
|
||||||
|
console.log("done loading")
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
await promise;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
resolveGuildidFromChannelID(ID){
|
resolveGuildidFromChannelID(ID){
|
||||||
let resolve=this.guilds.find(guild => guild.channelids[ID])
|
let resolve=this.guilds.find(guild => guild.channelids[ID])
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
function getCookie(name) {
|
|
||||||
return localStorage.getItem(name);
|
|
||||||
}
|
|
||||||
function setTheme(){
|
function setTheme(){
|
||||||
const name=localStorage.getItem("theme");
|
const name=localStorage.getItem("theme");
|
||||||
if(!name){
|
if(!name){
|
||||||
|
@ -10,7 +7,83 @@ function setTheme(){
|
||||||
document.body.className=name+"-theme";
|
document.body.className=name+"-theme";
|
||||||
}
|
}
|
||||||
setTheme();
|
setTheme();
|
||||||
|
function getBulkUsers(){
|
||||||
|
const json=JSON.parse(localStorage.getItem("userinfos"));
|
||||||
|
for(const thing in json.users){
|
||||||
|
json.users[thing]=new specialuser(json.users[thing]);
|
||||||
|
}
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
function getBulkInfo(){
|
||||||
|
return JSON.parse(localStorage.getItem("userinfos"));
|
||||||
|
}
|
||||||
|
function setDefaults(){
|
||||||
|
let userinfos=localStorage.getItem("userinfos");
|
||||||
|
if(!userinfos){
|
||||||
|
localStorage.setItem("userinfos",JSON.stringify({
|
||||||
|
currentuser:null,
|
||||||
|
users:{},
|
||||||
|
preferances:
|
||||||
|
{
|
||||||
|
theme:"Dark",
|
||||||
|
notifcations:false,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setDefaults();
|
||||||
|
class specialuser{
|
||||||
|
constructor(json){
|
||||||
|
console.log(json)
|
||||||
|
if(typeof json==="specialuser"){
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
this.serverurls=json.serverurls;
|
||||||
|
this.serverurls.api=new URL(this.serverurls.api);
|
||||||
|
this.serverurls.cdn=new URL(this.serverurls.cdn);
|
||||||
|
this.serverurls.gateway=new URL(this.serverurls.gateway);
|
||||||
|
this.serverurls.wellknown=new URL(this.serverurls.wellknown);
|
||||||
|
this.email=json.email;
|
||||||
|
this.token=json.token;
|
||||||
|
this.loggedin=json.loggedin;
|
||||||
|
this.json=json;
|
||||||
|
if(!this.serverurls||!this.email||!this.token){
|
||||||
|
console.error("There are fundamentally missing pieces of info missing from this user");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set pfpsrc(e){
|
||||||
|
this.json.pfpsrc=e;
|
||||||
|
this.updateLocal();
|
||||||
|
}
|
||||||
|
get pfpsrc(){
|
||||||
|
return this.json.pfpsrc;
|
||||||
|
}
|
||||||
|
set username(e){
|
||||||
|
this.json.username=e;
|
||||||
|
this.updateLocal();
|
||||||
|
}
|
||||||
|
get username(){
|
||||||
|
return this.json.username;
|
||||||
|
}
|
||||||
|
get uid(){
|
||||||
|
return this.email+this.serverurls.wellknown;
|
||||||
|
}
|
||||||
|
toJSON(){
|
||||||
|
return this.json;
|
||||||
|
}
|
||||||
|
updateLocal(){
|
||||||
|
const info=getBulkInfo();
|
||||||
|
info.users[this.uid]=this.toJSON();
|
||||||
|
localStorage.setItem("userinfos",JSON.stringify(info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function adduser(user){
|
||||||
|
user=new specialuser(user);
|
||||||
|
const info=getBulkInfo();
|
||||||
|
info.users[user.uid]=user;
|
||||||
|
info.currentuser=user.uid;
|
||||||
|
localStorage.setItem("userinfos",JSON.stringify(info));
|
||||||
|
}
|
||||||
const instancein=document.getElementById("instancein");
|
const instancein=document.getElementById("instancein");
|
||||||
let timeout=0;
|
let timeout=0;
|
||||||
async function checkInstance(e){
|
async function checkInstance(e){
|
||||||
|
@ -67,7 +140,8 @@ async function login(username, password){
|
||||||
return response.errors.login._errors[0].message;
|
return response.errors.login._errors[0].message;
|
||||||
console.log("test")
|
console.log("test")
|
||||||
}
|
}
|
||||||
localStorage.setItem("token",response.token);
|
//this.serverurls||!this.email||!this.token
|
||||||
|
adduser({serverurls:JSON.parse(localStorage.getItem("instanceinfo")),email:username,token:response.token});
|
||||||
window.location.href = '/channels/@me';
|
window.location.href = '/channels/@me';
|
||||||
return response.token;
|
return response.token;
|
||||||
})
|
})
|
||||||
|
@ -99,14 +173,6 @@ async function setInstance(url){
|
||||||
return await attempt(wellKnown);
|
return await attempt(wellKnown);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gettoken(){
|
|
||||||
let temp=getCookie("token");
|
|
||||||
temp??=undefined;
|
|
||||||
if(temp===undefined){
|
|
||||||
window.location.href = '/login.html';
|
|
||||||
}
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function check(e){
|
async function check(e){
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,10 @@ class cmessage{
|
||||||
document.getElementById("typebox").value=this.content;
|
document.getElementById("typebox").value=this.content;
|
||||||
},null,_=>{return _.author.id==READY.d.user.id});
|
},null,_=>{return _.author.id==READY.d.user.id});
|
||||||
}
|
}
|
||||||
constructor(messagejson){
|
constructor(messagejson,owner){
|
||||||
|
console.log(owner)
|
||||||
|
this.owner=owner;
|
||||||
|
this.headers=this.owner.headers;
|
||||||
for(const thing of Object.keys(messagejson)){
|
for(const thing of Object.keys(messagejson)){
|
||||||
this[thing]=messagejson[thing];
|
this[thing]=messagejson[thing];
|
||||||
}
|
}
|
||||||
|
@ -70,7 +73,7 @@ class cmessage{
|
||||||
line2.classList.add("reply");
|
line2.classList.add("reply");
|
||||||
line.classList.add("startreply");
|
line.classList.add("startreply");
|
||||||
replyline.classList.add("replyflex")
|
replyline.classList.add("replyflex")
|
||||||
fetch(info.api.toString()+"/v9/channels/"+this.message_reference.channel_id+"/messages?limit=1&around="+this.message_reference.message_id,{headers:{Authorization:token}}).then(responce=>responce.json()).then(responce=>{
|
fetch(info.api.toString()+"/v9/channels/"+this.message_reference.channel_id+"/messages?limit=1&around="+this.message_reference.message_id,{headers:this.headers}).then(responce=>responce.json()).then(responce=>{
|
||||||
const author=new user(responce[0].author);
|
const author=new user(responce[0].author);
|
||||||
|
|
||||||
reply.appendChild(markdown(responce[0].content));
|
reply.appendChild(markdown(responce[0].content));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue