# this IRC bot made with Sopel (https://sopel.chat/) counts the occurances of a word (strangulation in this case), reading from the automatically saved log (script Limechat on MAC) 
#it prints it every 5 seconds


import sopel.module

@sopel.module.interval(15)
def spam_every_5s(bot):

    file = open('/Users/p/Desktop/IRC_log/#algolit/2016-03-05_freenode.txt')
    looog = file.read()

    word = "strangulation"
    count = looog.count(word)

    if "#algolit" in bot.channels:
        bot.msg("#algolit", "the word \"strangulation\" has been used a bit too often, like " + str(count) + " times")