-
Notifications
You must be signed in to change notification settings - Fork 1
/
_qtelldummy.py
44 lines (31 loc) · 1.3 KB
/
_qtelldummy.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
"""
This is a Qtell replacement module, it does not support Transliteration/unicode.
"""
class QtellDummy():
"""
This is a simple class to provide functionality/compatibility if qtells are
not available.
It does not provide such a fancy things as Qtell. Does NOT provide the next
function.
"""
def set_header(self, header):
self.width = 170
pass
def __call__(self, user, data):
return self.split(user, data)
def split(self, usr, data):
data = data.split('\n')
new_data = []
for line in data:
for i in xrange(0, len(line)/self.width + 1):
new_data += [line[self.width*i: self.width*(i+1)]]
handle = usr['handle']
return ('tell %s %s' % (handle, line) for line in new_data)
def send(self, usr):
return 'tell %s Next command not available in qtell_dummy mode. This bot probably has no qtell rights. If you did not use next, the programmer did something weird ...' % usr['handle']
def send_list(self, usr, data):
new_data = []
for split in (i.split('\n') for i in data):
new_data += split
handle = usr['handle']
return ('tell %s %s' % (handle, line) for line in new_data)