typing out a lot of the JSON
This commit is contained in:
parent
514f81ee8b
commit
58b79be7f2
19 changed files with 359 additions and 44 deletions
|
@ -5,6 +5,7 @@ import { Contextmenu } from "./contextmenu.js";
|
|||
import { Fullscreen } from "./fullscreen.js";
|
||||
import { Permissions } from "./permissions.js";
|
||||
import { Settings, RoleList } from "./settings.js";
|
||||
import { Role } from "./role.js";
|
||||
import { InfiniteScroller } from "./infiniteScroller.js";
|
||||
import { SnowFlake } from "./snowflake.js";
|
||||
class Channel {
|
||||
|
@ -125,7 +126,7 @@ class Channel {
|
|||
}
|
||||
;
|
||||
this.permission_overwrites.set(thing.id, new Permissions(thing.allow, thing.deny));
|
||||
this.permission_overwritesar.push([thing.id, this.permission_overwrites.get(thing.id)]);
|
||||
this.permission_overwritesar.push([SnowFlake.getSnowFlakeFromID(thing.id, Role), this.permission_overwrites.get(thing.id)]);
|
||||
}
|
||||
this.topic = json.topic;
|
||||
this.nsfw = json.nsfw;
|
||||
|
@ -566,7 +567,7 @@ class Channel {
|
|||
delChannel(json) {
|
||||
const build = [];
|
||||
for (const thing of this.children) {
|
||||
if (thing.snowflake !== json.id) {
|
||||
if (thing.id !== json.id) {
|
||||
build.push(thing);
|
||||
}
|
||||
}
|
||||
|
@ -659,7 +660,7 @@ class Channel {
|
|||
}
|
||||
;
|
||||
this.permission_overwrites.set(thing.id, new Permissions(thing.allow, thing.deny));
|
||||
this.permission_overwritesar.push([thing.id, this.permission_overwrites.get(thing.id)]);
|
||||
this.permission_overwritesar.push([SnowFlake.getSnowFlakeFromID(thing.id, Role), this.permission_overwrites.get(thing.id)]);
|
||||
}
|
||||
this.topic = json.topic;
|
||||
this.nsfw = json.nsfw;
|
||||
|
|
|
@ -41,7 +41,7 @@ class Direct extends Guild {
|
|||
return Number(-result);
|
||||
});
|
||||
}
|
||||
giveMember(member) {
|
||||
giveMember(_member) {
|
||||
console.error("not a real guild, can't give member object");
|
||||
}
|
||||
getRole(ID) {
|
||||
|
|
|
@ -5,6 +5,7 @@ class Embed {
|
|||
owner;
|
||||
json;
|
||||
constructor(json, owner) {
|
||||
console.log(json);
|
||||
this.type = this.getType(json);
|
||||
this.owner = owner;
|
||||
this.json = json;
|
||||
|
|
1
.dist/jsontypes.js
Normal file
1
.dist/jsontypes.js
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -114,7 +114,7 @@ class Localuser {
|
|||
"capabilities": 16381,
|
||||
"properties": {
|
||||
"browser": "Jank Client",
|
||||
"client_build_number": 0,
|
||||
"client_build_number": 0, //might update this eventually lol
|
||||
"release_channel": "Custom",
|
||||
"browser_user_agent": navigator.userAgent
|
||||
},
|
||||
|
@ -262,7 +262,7 @@ class Localuser {
|
|||
delChannel(json) {
|
||||
json.guild_id ??= "@me";
|
||||
this.guildids.get(json.guild_id).delChannel(json);
|
||||
if (json.guild_id === this.lookingguild.snowflake) {
|
||||
if (json.guild_id === this.lookingguild.id) {
|
||||
this.loadGuild(json.guild_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,11 +27,13 @@ class Member {
|
|||
let membery = memberjson;
|
||||
this.roles = [];
|
||||
if (!error) {
|
||||
if (memberjson.guild_member) {
|
||||
if (memberjson["guild_member"]) {
|
||||
memberjson = memberjson;
|
||||
membery = memberjson.guild_member;
|
||||
this.user = memberjson.user;
|
||||
this.user = new User(memberjson.user, this.localuser);
|
||||
}
|
||||
}
|
||||
membery = membery;
|
||||
for (const thing of Object.keys(membery)) {
|
||||
if (thing === "guild") {
|
||||
continue;
|
||||
|
|
|
@ -22,6 +22,7 @@ class Message {
|
|||
static del;
|
||||
static resolve;
|
||||
div;
|
||||
member;
|
||||
get id() {
|
||||
return this.snowflake.id;
|
||||
}
|
||||
|
@ -61,6 +62,7 @@ class Message {
|
|||
this.giveData(messagejson);
|
||||
}
|
||||
giveData(messagejson) {
|
||||
console.log(messagejson);
|
||||
for (const thing of Object.keys(messagejson)) {
|
||||
if (thing === "attachments") {
|
||||
this.attachments = [];
|
||||
|
@ -77,6 +79,10 @@ class Message {
|
|||
this.snowflake = new SnowFlake(messagejson.id, this);
|
||||
continue;
|
||||
}
|
||||
else if (thing === "member") {
|
||||
this.member = new Member(messagejson.member, this.guild);
|
||||
continue;
|
||||
}
|
||||
this[thing] = messagejson[thing];
|
||||
}
|
||||
for (const thing in this.embeds) {
|
||||
|
@ -87,6 +93,11 @@ class Message {
|
|||
for (const thing in this.mentions) {
|
||||
this.mentions[thing] = new User(this.mentions[thing], this.localuser);
|
||||
}
|
||||
if (!this.member && this.guild.id !== "@me") {
|
||||
this.author.resolvemember(this.guild).then(_ => {
|
||||
this.member = _;
|
||||
});
|
||||
}
|
||||
if (this.mentions.length || this.mention_roles.length) { //currently mention_roles isn't implemented on the spacebar servers
|
||||
console.log(this.mentions, this.mention_roles);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class User {
|
|||
}
|
||||
}
|
||||
async resolvemember(guild) {
|
||||
await Member.resolve(this, guild);
|
||||
return await Member.resolve(this, guild);
|
||||
}
|
||||
buildpfp() {
|
||||
const pfp = document.createElement('img');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue