Created
April 28, 2018 04:00
-
-
Save dword4/fec4339009d31d0324fe606fc7ea4c3f to your computer and use it in GitHub Desktop.
say wat one more #$&!@ time, I dare you! this prints West African Time every time someone says just the word wat in any channel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__module_name__ = "wat" | |
__module_version__ = "1.0" | |
__module_description__ = "say wat!" | |
import hexchat | |
import re | |
from datetime import datetime | |
from datetime import timedelta | |
def count_words(somevar): | |
s = somevar | |
words = s.split(' ') | |
return len(words) | |
def checkmessage_cb(word, word_eol, userdata): | |
if len(word) == 4: | |
msg = re.sub('\:','',word[3]) | |
if msg.lower() == 'wat': | |
# lets get the time in west africa, need to adjust for difference from local time | |
wat = datetime.now() + timedelta(hours=5) | |
chan = hexchat.get_info("channel") | |
msg = "PRIVMSG %s West African Time: %s" % (chan, wat) | |
hexchat.command(msg) | |
return hexchat.EAT_ALL | |
hexchat.hook_server('PRIVMSG', checkmessage_cb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment