-
Notifications
You must be signed in to change notification settings - Fork 0
/
cs.py
34 lines (27 loc) · 1.36 KB
/
cs.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
# cs.py: some chanserv based things
from pylinkirc import utils, world
from pylinkirc.log import log
desc = "Welcome bot. Messages newly registered channels with helpful info."
welcome = utils.registerService("welcome", nick="Welcome", ident="Welcome", desc=desc)
def hook_privmsg(irc, source, command, args):
weuid = irc.nickToUid('Welcome')
channel = args['target']
text = args['text']
# irc.pseudoclient stores the IrcUser object of the main PyLink client.
# (i.e. the user defined in the bot: section of the config)
if 'used REGISTER on' in text and channel == '#debug':
nick = text.split()
nick = nick[1]
nick = nick.split('!')
nick = nick[0]
regchannel = text.split()
regchannel = regchannel[6]
irc.proto.join(weuid, regchannel)
irc.proto.message(weuid, regchannel, 'Welcome to ElectroCode, %s' % nick)
irc.proto.message(weuid, regchannel, "I've auto-assigned a bot for you to use. If you want a different one, you can look at '/bs botlist'.")
irc.proto.message(weuid, regchannel, "If you have any problems, please join '#help'.")
irc.proto.message(weuid, regchannel, "If you've seen this before, just ignore me.")
irc.proto.part(weuid, regchannel, "Welcome")
utils.add_hook(hook_privmsg, 'PRIVMSG')
def die(irc):
utils.unregisterService('welcome')