Skip to content

Instantly share code, notes, and snippets.

@maxpowa
Last active September 24, 2016 17:26
Show Gist options
  • Save maxpowa/867968b6200bca7083005b7e9d0df233 to your computer and use it in GitHub Desktop.
Save maxpowa/867968b6200bca7083005b7e9d0df233 to your computer and use it in GitHub Desktop.
lastCusses = {}
@rule('some-cuss-regex')
def my_module_func(bot, trigger):
if not lastCusses[trigger.nick]:
lastCusses[trigger.nick] = []
lastCusses[trigger.nick].append(trigger.time)
if len(lastCusses[trigger.nick]) >= 3:
firstCuss = lastCusses[trigger.nick].pop(0)
if (trigger.time - firstCuss).total_seconds <= 60:
bot.say('warning')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment