This commit is contained in:
Erik 2022-09-01 19:58:00 +03:00
parent 9ca14d5e39
commit f6e3f6c38d
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 4 additions and 4 deletions

View File

@ -191,7 +191,7 @@ class DiscordClient extends Client {
} }
defaultConfig(type) { defaultConfig(type) {
if(this._defaultConfig[type]) return this._defaultConfig[type]; if (this._defaultConfig[type]) return JSON.parse(JSON.stringify(this._defaultConfig[type]));
const settings = this.registry.components.filter((c) => c._type === 'setting' && c.resolve === type); const settings = this.registry.components.filter((c) => c._type === 'setting' && c.resolve === type);
let def = type === 'GUILD' ? DefaultGuild : DefaultUser; let def = type === 'GUILD' ? DefaultGuild : DefaultUser;
for(const setting of settings.values()) { for(const setting of settings.values()) {
@ -203,7 +203,7 @@ class DiscordClient extends Client {
} }
} }
this._defaultConfig[type] = def; this._defaultConfig[type] = def;
return def; return JSON.parse(JSON.stringify(def));
} }
async _setActivity() { async _setActivity() {

View File

@ -122,7 +122,7 @@ class UtilityHook extends Observer {
const me = await guild.resolveMember(this.client.user); const me = await guild.resolveMember(this.client.user);
if (!me.permissions.has('ManageRoles')) return; if (!me.permissions.has('ManageRoles')) return;
const _roles = await guild.resolveRoles(setting.roles); const _roles = await guild.resolveRoles(setting.roles || []);
if (_roles.some((r) => r.position >= me.roles.highest.position)) return; if (_roles.some((r) => r.position >= me.roles.highest.position)) return;
const roles = _roles.map((r) => r.id); const roles = _roles.map((r) => r.id);
// Sometimes the member isn't available on the API for some reason, // Sometimes the member isn't available on the API for some reason,

View File

@ -215,7 +215,7 @@ class SettingsMigrator {
const { moderation, modlogs, muterole, mutetype, automod, wordFilter, ignore, invitefilter, const { moderation, modlogs, muterole, mutetype, automod, wordFilter, ignore, invitefilter,
chatlogs, activity, selfrole, killitwithfire, memberlogs, staffRole, staffRule, modpoints, chatlogs, activity, selfrole, killitwithfire, memberlogs, staffRole, staffRule, modpoints,
userlogs, grantable, privatelog, linkfilter, autorole, welcomer, prefix, protection } = result; userlogs, grantable, privatelog, linkfilter, autorole, welcomer, prefix, protection } = result;
const settings = this.client.defaultConfig('GUILD'); const settings = JSON.parse(JSON.stringify(this.client.defaultConfig('GUILD')));
if (staffRole || staffRole) { if (staffRole || staffRole) {
settings.staff = { settings.staff = {