get rid of the odd complexity of the snowflake class

This commit is contained in:
MathMan05
2024-09-03 10:34:40 -05:00
parent b72d7673f4
commit 03041cf9fd
13 changed files with 237 additions and 257 deletions

View File

@@ -18,7 +18,7 @@ class Guild{
snowflake:SnowFlake<Guild>;
properties;
roles:Role[];
roleids:Map<SnowFlake<Role>,Role>;
roleids:Map<string,Role>;
prevchannel:Channel|undefined;
message_notifications:number;
headchannels:Channel[];
@@ -80,9 +80,9 @@ class Guild{
const settings=new Settings("Settings for "+this.properties.name);
const s1=settings.addButton("roles");
const permlist:[SnowFlake<Role>,Permissions][]=[];
const permlist:[Role,Permissions][]=[];
for(const thing of this.roles){
permlist.push([thing.snowflake,thing.permissions]);
permlist.push([thing,thing.permissions]);
}
s1.options.push(new RoleList(permlist,this,this.updateRolePermissions.bind(this)));
settings.show();
@@ -109,7 +109,7 @@ class Guild{
for(const roley of json.roles){
const roleh=new Role(roley,this);
this.roles.push(roleh);
this.roleids.set(roleh.snowflake,roleh);
this.roleids.set(roleh.id,roleh);
}
if(member instanceof User){
Member.resolveMember(member,this).then(_=>{
@@ -231,7 +231,7 @@ class Guild{
if(thing.move_id&&thing.move_id!==thing.parent_id){
thing.parent_id=thing.move_id;
thisthing.parent_id=thing.parent?.id;
thing.move_id=null;
thing.move_id=undefined;
}
if(thisthing.position||thisthing.parent_id){
build.push(thisthing);
@@ -554,7 +554,7 @@ class Guild{
});
const json=await fetched.json();
const role=new Role(json,this);
this.roleids.set(role.snowflake,role);
this.roleids.set(role.id,role);
this.roles.push(role);
return role;
}