MCPcopy Create free account
hub / github.com/RTByte/rtbyte / setControlGuild

Method setControlGuild

src/events/rtbyteReady.js:63–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61 }
62
63 async setControlGuild() {
64 await this.client.emit('verbose', 'Setting control guild.');
65 // Fail initialization if bot is not in the configured control guild
66 if (!this.client.guilds.cache.has(this.client.options.controlGuild)) return;
67
68 // Making sure we have a fully resolved guild object
69 const controlGuild = await this.client.guilds.resolve(this.client.options.controlGuild);
70
71 // Fail initialization if the control guild is not available for initialization
72 if (!controlGuild.available) return;
73
74 // Fail initialization if bot doesn't have administrator permissions in the control guild
75 if (!controlGuild.me.permissions.has('ADMINISTRATOR')) return;
76
77 // Registering control guild in clientStorage
78 await this.client.settings.update('guilds.controlGuild', controlGuild.id);
79 await this.client.settings.sync(true);
80
81 return;
82 }
83
84};

Callers 1

runMethod · 0.80

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected