inital emoji support

This commit is contained in:
MathMan05 2024-08-05 19:06:26 -05:00
parent d2294d9ac7
commit 8b3fe48a74
12 changed files with 377 additions and 7 deletions

View file

@ -363,7 +363,7 @@ class Localuser {
const div = document.createElement("div");
div.classList.add("home", "servericon");
img.src = "/icons/home.svg";
img.classList.add("svgtheme");
img.classList.add("svgtheme", "svgicon");
img["all"] = this.guildids.get("@me");
this.guildids.get("@me").html = outdiv;
const unread = document.createElement("div");
@ -407,7 +407,7 @@ class Localuser {
const guilddsdiv = document.createElement("div");
const guildDiscoveryContainer = document.createElement("img");
guildDiscoveryContainer.src = "/icons/explore.svg";
guildDiscoveryContainer.classList.add("svgtheme");
guildDiscoveryContainer.classList.add("svgtheme", "svgicon");
guilddsdiv.classList.add("home", "servericon");
guilddsdiv.appendChild(guildDiscoveryContainer);
serverlist.appendChild(guilddsdiv);
@ -922,5 +922,57 @@ class Localuser {
]);
botDialog.show();
}
//---------- resolving members code -----------
waitingmembers = new Map();
async resolvemember(id, guildid) {
console.warn("this function is currently non-functional, either due to a bug in the client or the server, it's currently unclear, use at your own risk");
if (!this.waitingmembers.has(guildid)) {
this.waitingmembers.set(guildid, new Map());
}
let res;
const promise = new Promise((r) => {
res = r;
});
this.waitingmembers.get(guildid).set(id, res);
this.getmembers();
return await promise;
}
fetchingmembers = new Map();
async getmembers() {
if (this.ws) {
this.waitingmembers.forEach(async (value, guildid) => {
const keys = value.keys();
if (this.fetchingmembers.has(guildid)) {
return;
}
const build = [];
for (const key of keys) {
build.push(key);
}
;
let res;
const promise = new Promise((r) => {
res = r;
});
this.ws.send(JSON.stringify({
op: 8,
d: {
query: "",
user_ids: build,
guild_id: guildid,
limit: 100,
nonce: "" + Math.floor(Math.random() * 100000000)
}
}));
this.fetchingmembers.set(guildid, res);
const data = await promise;
for (const thing of data) {
value.get(thing.id)(thing);
value.delete(thing.id);
}
this.getmembers();
});
}
}
}
export { Localuser };