Don't send status messages when NODE_ENV is development

This commit is contained in:
Supositware 2022-08-17 16:22:49 +02:00
parent ce945612da
commit 3b38401afc
3 changed files with 6 additions and 6 deletions

View file

@ -4,7 +4,7 @@ import { MessageEmbed } from 'discord.js';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
const { statusChannel } = process.env; const { statusChannel, NODE_ENV } = process.env;
export default { export default {
name: 'guildCreate', name: 'guildCreate',
@ -21,7 +21,7 @@ export default {
} }
// If stats channel settings exist, send bot stats to it // If stats channel settings exist, send bot stats to it
if (statusChannel) { if (statusChannel && NODE_ENV !== 'development') {
const channel = client.channels.resolve(statusChannel); const channel = client.channels.resolve(statusChannel);
const botCount = guild.members.cache.filter(member => member.user.bot).size; const botCount = guild.members.cache.filter(member => member.user.bot).size;
console.log(guild.memberCount); console.log(guild.memberCount);

View file

@ -4,7 +4,7 @@ import { MessageEmbed } from 'discord.js';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
const { statusChannel } = process.env; const { statusChannel, NODE_ENV } = process.env;
export default { export default {
name: 'guildDelete', name: 'guildDelete',
@ -17,7 +17,7 @@ export default {
const blacklist = await guildBlacklist.findOne({ where: { guildID:guild.id } }); const blacklist = await guildBlacklist.findOne({ where: { guildID:guild.id } });
// If stats channel settings exist, send bot stats to it // If stats channel settings exist, send bot stats to it
if (statusChannel) { if (statusChannel && NODE_ENV !== 'development') {
const channel = client.channels.resolve(statusChannel); const channel = client.channels.resolve(statusChannel);
const botCount = guild.members.cache.filter(member => member.user.bot).size; const botCount = guild.members.cache.filter(member => member.user.bot).size;
console.log(guild.memberCount); console.log(guild.memberCount);

View file

@ -1,7 +1,7 @@
import { exec } from 'node:child_process'; import { exec } from 'node:child_process';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
const { statusChannel } = process.env; const { statusChannel, NODE_ENV } = process.env;
export default { export default {
name: 'ready', name: 'ready',
@ -34,7 +34,7 @@ export default {
console.log('===========[ READY ]==========='); console.log('===========[ READY ]===========');
// If stats channel settings exist, send bot stats to it // If stats channel settings exist, send bot stats to it
if (statusChannel) { if (statusChannel && NODE_ENV !== 'development') {
const channel = client.channels.resolve(statusChannel); const channel = client.channels.resolve(statusChannel);
channel.send(`Ready to serve in ${channelSize} channels on ${guildSize} servers.\nThere is ${commandSize} command loaded.\nRunning yt-dlp ${ytdlpVersion.replace('\n', '')}\n${client.readyAt}`); channel.send(`Ready to serve in ${channelSize} channels on ${guildSize} servers.\nThere is ${commandSize} command loaded.\nRunning yt-dlp ${ytdlpVersion.replace('\n', '')}\n${client.readyAt}`);
} }