MCPcopy Create free account
hub / github.com/MathMan05/Fermi / constructor

Method constructor

src/webpage/guild.ts:1493–1560  ·  view source on GitHub ↗
(json: guildjson | -1, owner: Localuser, member: memberjson | User | null)

Source from the content-addressed store, hash-verified

1491 this.roleids.delete(id);
1492 this.roles.splice(this.roles.indexOf(role), 1);
1493 this.roleUpdate(role, -1);
1494 }
1495 onEmojiUpdate = (_: emojipjson[]) => {};
1496 update(json: extendedProperties) {
1497 this.large = json.large;
1498 this.member_count = json.member_count;
1499 this.emojis = json.emojis || [];
1500 this.headers = this.owner.headers;
1501 this.welcomeScreen = json.welcome_screen;
1502 if (this.properties)
1503 if (this.properties.icon !== json.icon) {
1504 this.properties.icon = json.icon;
1505 if (this.HTMLicon) {
1506 const divy = this.generateGuildIcon();
1507 this.HTMLicon.replaceWith(divy);
1508 this.HTMLicon = divy;
1509 }
1510 }
1511 this.roleids.clear();
1512 this.banner = json.banner;
1513 this.welcomeScreen = json.welcome_screen;
1514
1515 this.properties = json;
1516 }
1517 constructor(json: guildjson | -1, owner: Localuser, member: memberjson | User | null) {
1518 super(typeof json === "number" ? "@me" : json.id);
1519 this.owner = owner;
1520 this.perminfo ??= {channels: {}};
1521 this.headers = this.owner.headers;
1522
1523 if (json === -1 || member === null) {
1524 return;
1525 }
1526
1527 this.update({...json.properties, large: json.large, emojis: json.emojis});
1528
1529 this.member_count = json.member_count;
1530 this.channels = [];
1531
1532 this.roles = [];
1533
1534 if (json.roles) {
1535 for (const roley of json.roles) {
1536 const roleh = new Role(roley, this);
1537 this.roles.push(roleh);
1538 this.roleids.set(roleh.id, roleh);
1539 }
1540 }
1541
1542 this.messageNotifications = 0;
1543 this.sortRoles();
1544 if (member instanceof User) {
1545 Member.resolveMember(member, this).then((_) => {
1546 if (!_) {
1547 console.error("Member was unable to resolve");
1548 }
1549 });
1550 } else {

Callers

nothing calls this directly

Calls 5

sortRolesMethod · 0.95
resolveparentMethod · 0.95
errorMethod · 0.80
newUnsafeMethod · 0.80
resolveMemberMethod · 0.45

Tested by

no test coverage detected