-
Notifications
You must be signed in to change notification settings - Fork 1
/
hooks.py
58 lines (53 loc) · 2.29 KB
/
hooks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import utils
from handles import *
def check_reminders(irc, args):
nick = args.sender.nick
if args.type == "NICK":
nick = args.args[0]
userObj = irc.get_user(nick)
if userObj.reminders == []:
return
for reminder in userObj.reminders:
if reminder[3] in ["channel"]:
to = reminder[5]
elif reminder[3] in ["pm", "private message"]:
to = userObj.nickname
irc.msg(to, "✉ │ %s: %s · from %s · ⌚ %s ago" %
(userObj.nickname, reminder[2], reminder[1].split("!")[0], utils.timesince(reminder[4])))
userObj.reminders.remove(reminder)
def main():
utils.add_hook(check_reminders, ["JOIN", "NICK", "PRIVMSG", "NOTICE"])
utils.add_hook(PRIVMSG.handle_NOTICE, ["NOTICE", "PRIVMSG"])
utils.add_hook(NUMERIC.handle_001, "001")
utils.add_hook(NUMERIC.handle_002, "002")
utils.add_hook(NUMERIC.handle_005, "005")
utils.add_hook(NUMERIC.handle_251, "251")
utils.add_hook(NUMERIC.handle_311, "311")
utils.add_hook(NUMERIC.handle_324, "324")
utils.add_hook(NUMERIC.handle_332, "332")
utils.add_hook(NUMERIC.handle_346, "346")
utils.add_hook(NUMERIC.handle_348, "348")
utils.add_hook(NUMERIC.handle_352, "352")
utils.add_hook(NUMERIC.handle_353, "353")
utils.add_hook(NUMERIC.handle_354, "354")
utils.add_hook(NUMERIC.handle_366, "366")
utils.add_hook(NUMERIC.handle_367, "367")
utils.add_hook(NUMERIC.handle_396, "396")
utils.add_hook(NUMERIC.handle_432, "432")
utils.add_hook(NUMERIC.handle_433, "433")
utils.add_hook(ACCOUNT.handle_ACCOUNT, "ACCOUNT")
utils.add_hook(ERROR.handle_ERROR, ["ERROR", "KILL"])
utils.add_hook(INVITE.handle_INVITE, "INVITE")
utils.add_hook(JOIN.handle_JOIN, "JOIN")
utils.add_hook(KICK.handle_KICK, "KICK")
utils.add_hook(MODE.handle_MODE, "MODE")
utils.add_hook(NICK.handle_NICK, "NICK")
utils.add_hook(PART.handle_PART, "PART")
utils.add_hook(PING.handle_PING, "PING")
utils.add_hook(QUIT.handle_QUIT, "QUIT")
utils.add_hook(SASL.handle_CAP, "CAP")
utils.add_hook(SASL.handle_AUTHENTICATE, "AUTHENTICATE")
utils.add_hook(SASL.handle_903, "903")
utils.add_hook(SASL.handle_904, ["904, 905"])
utils.add_hook(SASL.handle_905, "905")
utils.add_hook(TOPIC.handle_TOPIC, "TOPIC")