Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
handle nulls on guild count updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sr229 committed Feb 17, 2018
1 parent 5a0077d commit a82aa89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/events/guilds.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = bot => {
if (guild.members.filter(m => m.bot).filter / guild.members.size >= 0.50) {
logger.info(`Detected bot collection guild '${guild.name}' (${guild.id}). Autoleaving...`);
await guild.leave();
} else if (!bot.config.gameURL) {
} else if (!bot.config.gameURL || bot.config.gameURL === null) {
await bot.editStatus('online', {
name: `${bot.config.gameName || `${bot.config.mainPrefix}help for commands!`} | ${bot.guilds.size} ${bot.guilds.size === 1 ? 'server' : 'servers'}`,
type: 0,
Expand All @@ -27,7 +27,7 @@ module.exports = bot => {
bot.on('guildDelete', async guild => {
if (guild.members.filter(m => m.bot).filter / guild.members.size >= 0.50) return;

if (!bot.config.gameURL) {
if (!bot.config.gameURL || bot.config.gameURL === null) {
await bot.editStatus('online', {
name: `${bot.config.gameName || `${bot.config.mainPrefix}help for commands!`} | ${bot.guilds.size} ${bot.guilds.size === 1 ? 'server' : 'servers'}`,
type: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = bot => {
logger.error(`Error while starting up:\n${err.stack}`);
}
} else logger.info('Reconnected to Discord from disconnection.');
if (!bot.config.gameURL) {
if (!bot.config.gameURL || bot.config.gameURL === null) {
await bot.editStatus('online', {
name: `${bot.config.gameName || `${bot.config.mainPrefix}help for commands!`} | ${bot.guilds.size} ${bot.guilds.size === 1 ? 'server' : 'servers'}`,
type: 0,
Expand Down

2 comments on commit a82aa89

@Ovyerus
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't matter as null is a falsey value.

@sr229
Copy link
Contributor Author

@sr229 sr229 commented on a82aa89 Feb 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ovyerus Yeah the problem is current Nightly thinks null should be status if set from config vars for some reason.

Please sign in to comment.