Skip to content

Commit

Permalink
add "ignore messages before start" plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Shemesh authored Mar 15, 2018
1 parent 66b8c19 commit 40b2f9f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions plugins/ignoreMessagesBeforeStart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var startDate;

module.exports = {

id: 'ignoreMessagesBeforeStart',

plugin(bot) {

bot.on('start', () => {
startDate = Date.now();
});

bot.mod('message', (data) => {
if (data.message.date*1000 < startDate) {
data.message = {};
}

return data;
});
}
};

0 comments on commit 40b2f9f

Please sign in to comment.