Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit 55e23fec672708101779b03a7acf3f754793ab94
parent d813cfdfc1a69557e24b1c9414d82b691393ddbc
Author: Demonstrandum <moi@knutsen.co>
Date:   Wed, 18 Mar 2020 00:57:34 +0000

Try and limit spam a little.

Diffstat:
Mlib/api/google.ts | 3++-
Mlib/main.ts | 16++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/lib/api/google.ts b/lib/api/google.ts @@ -15,7 +15,8 @@ const CACHE = { 'druggie': "https://vignette.wikia.nocookie.net/sausage-party-recipe-book/images/e/e7/Druggie.png/revision/latest/top-crop/width/360/height/450?cb=20170212165040\n>>> Hurr durr, arron's a shroomer lmao.", 'aaron fish': "https://i.pinimg.com/280x280_RS/fa/b5/96/fab5962b97d464781f65952b6b63e4a0.jpg\n>>> arron fish? arron fish. Blub blub.", 'sammy obese': "https://s3fs.bestfriends.org/s3fs-public/news/15/09/04/SIJenPettingSammy6919.jpg\n>>> sammy is a cute skinny twink, stfu.", - 'james obese': "https://i.dailymail.co.uk/i/pix/2014/02/18/article-2562421-1B9E557700000578-9_634x468.jpg\n>>> james very obese, yes, very original..." + 'james obese': "https://i.dailymail.co.uk/i/pix/2014/02/18/article-2562421-1B9E557700000578-9_634x468.jpg\n>>> james very obese, yes, very original...", + 'aaron penis': "http://m.quickmeme.com/img/ea/eaf8c78ae55815cc7786b1596f9a9767fc3c42b60efff8a2455150e4d0eb37b0.jpg\n>>> aaron's schlong is actually huge. shroomer schlong." }; // TODO: Reject results if they're from: diff --git a/lib/main.ts b/lib/main.ts @@ -103,10 +103,26 @@ export class SimpOMatic { } process_command(message : Message) { + const last_command = this._COMMAND_HISTORY.last(); this._COMMAND_HISTORY.push(message); if (this._COMMAND_HISTORY.length > CONFIG.commands.max_history) { this._COMMAND_HISTORY.shift(); } + const current_command = this._COMMAND_HISTORY.last(); + + // Try and slow the fellas down a little. + const delta = current_command.createdTimestamp - last_command.createdTimestamp; + if (last_command.content === current_command.content + && delta <= 1400) { + if (delta <= 400) return; + return message.answer(`I can't help but notice you're running \ + the same commands over in rather rapid succession. + Would you like to slow down a little?`.squeeze()) + } + if (delta <= 900) { + if (delta <= 300) return; + return message.answer('Slow down there bucko.'); + } const content = message.content.trim().squeeze(); const words = content.tail().split(' ');