-
Notifications
You must be signed in to change notification settings - Fork 6
/
t.py
39 lines (25 loc) · 760 Bytes
/
t.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
from testbot import TestTofbot, print_resp
class Origin:
pass
chan = '#test'
origin = Origin()
origin.sender = 'TestTofbot'
class Counter:
def __init__(self, n):
self.remaining_calls = n
def __call__(self, msg):
print_resp(msg)
self.remaining_calls -= 1
if self.remaining_calls < 0:
assert False
def cb_lines(n):
return Counter(n)
def cb_error(msg):
return cb_lines(0)
b = TestTofbot('ohohOHoh_bot', 'Le tof', chan, origin)
b.send("End of /MOTD command.", cb=cb_error)
b.send("test", cb=cb_error)
b.send("!help", cb=cb_lines(4))
b.send("!set autoTofadeThreshold 100", cb=cb_error)
b.send("!get autoTofadeThreshold", cb=cb_lines(1))
b.send("!get autoTofadeThreshold 2", cb=cb_error)