wait for client fully started to respond to msgs

master
Kit Kasune 3 years ago
parent 4a19bff4f0
commit bc8bf518d1
  1. 3
      bot.js
  2. 2
      events/messageCreate.js
  3. 2
      events/ready.js
  4. 4
      util/lxp/spawnchest.js

@ -63,7 +63,8 @@ client.misc = {
logs: 'normal', logs: 'normal',
lightstartup: false, lightstartup: false,
ignorecmds: [] ignorecmds: []
} },
fullyReady: false
}; };
//const config = require('./config.js'); //const config = require('./config.js');

@ -12,6 +12,8 @@ const Monners = require('../models/monners');
const channelTypes = ["GUILD_MESSAGE", "DM", "GUILD_NEWS_THREAD", "GUILD_PRIVATE_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_NEWS", "GROUP_DM", "GUILD_STORE", "GUILD_TEXT"]; const channelTypes = ["GUILD_MESSAGE", "DM", "GUILD_NEWS_THREAD", "GUILD_PRIVATE_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_NEWS", "GROUP_DM", "GUILD_STORE", "GUILD_TEXT"];
module.exports = async (client, message) => { module.exports = async (client, message) => {
if (!client.misc.fullyReady) {return;}
if (message.partial) {await message.fetch();} if (message.partial) {await message.fetch();}
if (message.channel.partial) {await message.channel.fetch();} if (message.channel.partial) {await message.channel.fetch();}

@ -108,5 +108,7 @@ module.exports = async client => {
await botData.save(); await botData.save();
client.misc.fullyReady = true;
require('../console')(client); require('../console')(client);
}; };

@ -5,8 +5,8 @@ const Discord = require('discord.js');
module.exports = async (client, member, channel, prefix) => { module.exports = async (client, member, channel, prefix) => {
if (client.misc.cache.chests.timeout.has(member.guild.id) && new Date().getTime() - client.misc.cache.chests.timeout.get(member.guild.id) < (1000 * 60 * 2)) {return;} if (client.misc.cache.chests.timeout.has(member.guild.id) && new Date().getTime() - client.misc.cache.chests.timeout.get(member.guild.id) < (1000 * 60 * 2)) {return;}
//let rand = Math.floor(Math.random() * 100); let rand = Math.floor(Math.random() * 100);
//if (rand !== 69) {return;} //decide if it even continues if (rand !== 69 && rand !== 42) {return;} //decide if it even continues
let tm = await Monners.findOne({uid: member.id}); let tm = await Monners.findOne({uid: member.id});
let streak = tm && tm.daily ? tm.daily.streak : 0; //get streak for bonus later let streak = tm && tm.daily ? tm.daily.streak : 0; //get streak for bonus later

Loading…
Cancel
Save