forked from Galactic/galactic-bot
- Skipping guild slash commands update when guild is unavailable
- Adding my personal test guild
This commit is contained in:
parent
d73d1b4798
commit
d0a236f9fb
@ -32,7 +32,8 @@
|
|||||||
"developerGuilds": [
|
"developerGuilds": [
|
||||||
"264527028751958016",
|
"264527028751958016",
|
||||||
"207880433432657920",
|
"207880433432657920",
|
||||||
"992757341848080486"
|
"992757341848080486",
|
||||||
|
"1069272779100266598"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -35,6 +35,12 @@ class SlashCommandManager {
|
|||||||
|
|
||||||
const cmdHash = hash(commands);
|
const cmdHash = hash(commands);
|
||||||
for (const guild of [...guilds]) {
|
for (const guild of [...guilds]) {
|
||||||
|
// Skip guild if unavailable
|
||||||
|
const res = await this.rest.get(Routes.guild(guild)).catch(() => { return null });
|
||||||
|
if (!res) {
|
||||||
|
guilds.splice(guilds.indexOf(guild), 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Skip guild update if hash is already up to date
|
// Skip guild update if hash is already up to date
|
||||||
if (this.hash.guilds[guild] === cmdHash) guilds.splice(guilds.indexOf(guild), 1);
|
if (this.hash.guilds[guild] === cmdHash) guilds.splice(guilds.indexOf(guild), 1);
|
||||||
// else update hash
|
// else update hash
|
||||||
|
@ -10,11 +10,11 @@ class MongoDBProvider extends Provider {
|
|||||||
config
|
config
|
||||||
});
|
});
|
||||||
|
|
||||||
const { MONGODB_HOST, MONGODB_USERNAME, MONGODB_PASSWORD, MONGODB_DATABASE } = process.env;
|
const { MONGODB_HOST, MONGODB_USERNAME, MONGODB_PASSWORD, MONGODB_DATABASE, MONGODB_AUTH_SOURCE } = process.env;
|
||||||
this.database = MONGODB_DATABASE;
|
this.database = MONGODB_DATABASE;
|
||||||
// const { database } = this.config;
|
// const { database } = this.config;
|
||||||
const auth = MONGODB_USERNAME ? `${MONGODB_USERNAME}:${MONGODB_PASSWORD}@`:'';
|
const auth = MONGODB_USERNAME ? `${MONGODB_USERNAME}:${MONGODB_PASSWORD}@`:'';
|
||||||
this.URI = `mongodb://${auth}${MONGODB_HOST}/${this.database}?authSource=${this.database}`;
|
this.URI = `mongodb://${auth}${MONGODB_HOST}/${this.database}?authSource=${MONGODB_AUTH_SOURCE || this.database}`;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user