Add ability to manually send ping from watch chan

This commit is contained in:
Skylar Grant 2023-02-17 14:44:43 -05:00
parent 77f87ede59
commit e21e6e510f
2 changed files with 11 additions and 3 deletions

View File

@ -4,7 +4,7 @@
const dotenv = require('dotenv');
dotenv.config();
const token = process.env.TOKEN;
const statusChannelId = process.env.statusChannelId;
const statusChannelId = process.env.STATUSCHANNELID;
// Discord.JS
const { Client, GatewayIntentBits, Partials, ActivityType } = require('discord.js');
@ -25,7 +25,7 @@ const client = new Client({
const fn = require('./modules/functions.js');
const strings = require('./data/strings.json');
const dbfn = require('./modules/dbfn.js');
const isDev = process.env.isDev;
const isDev = process.env.DEBUG;
client.once('ready', async () => {
await fn.collectionBuilders.slashCommands(client);

View File

@ -621,10 +621,18 @@ const functions = {
// console.log(guildInfo instanceof GuildInfo);
const channel = await guild.channels.fetch(guildInfo.watchChannelId);
const filter = message => {
return message.author.id != process.env.BOTID && message.embeds != undefined;
return message.author.id != process.env.BOTID;
}
const collector = channel.createMessageCollector({ filter });
collector.on('collect', message => {
if (message.content.toLowerCase().includes("water ping")) {
this.sendWaterReminder(guildInfo, guildInfo.waterMessage, guildInfo.reminderChannelId, guild);
return;
} else if (message.content.toLowerCase().includes("fruit ping")) {
this.sendFruitReminder(guildInfo, guildInfo.fruitMessage, guildInfo.reminderChannelId, guild);
return;
}
if (message.embeds == undefined) return;
if (message.embeds.length == 0) return;
guildInfo = client.guildInfos.get(guild.id);
if (message.embeds[0].data.description.includes(strings.notifications.water)) {