ping.js should work now

This commit is contained in:
Ladislav Hano 2023-03-03 15:22:38 +01:00
parent 28db7dba47
commit 51786417c7
3 changed files with 5 additions and 5 deletions

View file

@ -66,10 +66,11 @@ client.once('ready', async () => {
debugChannel.send(turnOnMsg[help.RNG(turnOnMsg.length)]); debugChannel.send(turnOnMsg[help.RNG(turnOnMsg.length)]);
} }
} }
await dbConnect();
cron.schedule('0 13 * * *', async function() { cron.schedule('0 13 * * *', async function() {
ping(); ping();
}); });
await dbConnect(); ping();
console.log('Running!'); console.log('Running!');
}); });

View file

@ -34,8 +34,7 @@ function gotMessage(message) {
} }
if (process.env.DEBUG == 'ON') { if (process.env.DEBUG == 'ON') {
const debugger_ = require('./.debug.js'); // smth
debugger_.debug(message);
} }
} }

View file

@ -1,7 +1,7 @@
require('dotenv').config(); require('dotenv').config();
const client = require('./main'); const client = require('./main');
const { bModel, eModel } = require('./database/schemas'); const { bModel, eModel } = require('./database/schemas');
const help = require('./helpFunctions'); const { getGifEmbed } = require('./gifs');
module.exports = pingEvent; module.exports = pingEvent;
@ -26,7 +26,7 @@ async function pingEvent() {
const userId = todayBirthdays[j].id; const userId = todayBirthdays[j].id;
if ((await guild.members.fetch()).find(user => user.id == userId) != undefined) { if ((await guild.members.fetch()).find(user => user.id == userId) != undefined) {
const gifAmount = 12; const gifAmount = 12;
const embed = await help.getGifEmbed(`https://g.tenor.com/v1/search?q=anime-hug&key=${process.env.TENOR}&limit=${gifAmount}`, gifAmount); const embed = await getGifEmbed(`https://g.tenor.com/v1/search?q=anime-hug&key=${process.env.TENOR}&limit=${gifAmount}`, gifAmount);
embed.setDescription(`Happy Birthday <@${userId}> !!!`); embed.setDescription(`Happy Birthday <@${userId}> !!!`);
client.channels.cache.get(sysChannelIds[i]) client.channels.cache.get(sysChannelIds[i])
.send({ embeds: [embed] }); .send({ embeds: [embed] });