-
Notifications
You must be signed in to change notification settings - Fork 1
/
autovoice.py
56 lines (41 loc) · 2.25 KB
/
autovoice.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
# -*- coding: utf-8 -*-
__url__ = "https://raw.githubusercontent.com/KittyHawkIrc/modules/production/" + __name__ + ".py"
__version__ = 2.0
def declare():
return {"autovoice": "userjoin", "verify": "privmsg"}
def callback(self):
if self.type == 'userjoin':
if self.channel == '#fatpeoplesuck' and self.profile.isverified:
self.mode(self.channel, True, 'v', user=self.profile.nickname)
else:
privlist = self.message.split()
if len(privlist) == 1: #^verify
return self.msg(self.channel, '%s: You %s verified.' % (
self.profile.nickname, ("are" if self.profile.isverified else "are not")))
elif len(privlist) == 2:
selector = self.profileManager.getuser_bynick(privlist[1])
if selector:
return self.msg(self.channel, '%s: %s %s verified.' % (
self.profile.nickname, selector.nickname, ("is" if selector.isverified else "is not")))
else:
return self.msg(self.channel, "%s: That user couldn't be found." % (
self.profile.nickname))
elif len(privlist) == 3:
if self.isop:
selector = self.profileManager.getuser_bynick(privlist[1])
if selector:
if 'y' in privlist[2].lower():
self.profileManager.update(selector.username, isverified=True)
elif 'n' in privlist[2].lower():
self.profileManager.update(selector.username, isverified=False)
else:
return self.msg(self.channel, "%s: That doesn't look like a real value" % (
self.profile.nickname))
return self.msg(self.channel, "%s: %s %s verified." % (
self.profile.nickname, selector.nickname, ("is now" if self.profileManager.getuser_bynick(privlist[1]).isverified else "is no longer")))
else:
return self.msg(self.channel, "%s: That user couldn't be found." % (
self.profile.nickname))
else:
return self.msg(self.channel, "%s: You don't have permissions to verify others" % (
self.profile.nickname))