Browse Source

Add onReady function in bot.js

shorten
benji7425 4 years ago
parent
commit
d22c9b91dc
  1. 7
      app/bot.js
  2. 2
      app/index.js

7
app/bot.js

@ -1,6 +1,13 @@
const GuildData = require("./models/guild-data.js");
module.exports = {
onReady(client, guildsData, config) {
return new Promise((resolve, reject) => {
parseLinksInGuilds(client.guilds, guildsData)
.then(() => checkFeedsInGuilds(client.guilds, guildsData))
.then(() => setInterval(() => checkFeedsInGuilds(client.guilds, guildsData), config.feedCheckIntervalSec * 1000)); //set up an interval to check all the feeds
});
},
onCommand(commandObj, commandsObj, params, guildData, message) {
switch (commandObj.command) {
case commandsObj.addFeed.command:

2
app/index.js

@ -38,6 +38,8 @@ module.exports = (client, config = null) => {
HandleMessage.text(client, config, message, guildsData);
}
});
Bot.onReady(client, guildsData, config).then(() => writeFile).catch(err => DiscordUtil.dateError(err));
};
const HandleMessage = {

Loading…
Cancel
Save