-
Notifications
You must be signed in to change notification settings - Fork 2
/
discobeep.py
60 lines (48 loc) · 1.99 KB
/
discobeep.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
59
60
from ibid.plugins import Processor, match, periodic, handler
import ibid.source.irc
import ibid
import subprocess
import os
features = {'discobeep': {
'description': u'Signals across the tubes.',
'categories': ('fun',),
}}
beepdisc = {
"PINGU" : "beep -f50 -r2 -l200 -n -f40 -r2".split(),
"FANTASY" : "beep -f49 -l53 -D53 -n -f49 -l53 -D53 -n -f49 -l53 -D53 -n -f49 -l428 -n -f39 -l428 -n -f44 -l428 -n -f49 -l107 -D214 -n -f44 -l107 -n -f49 -l857".split(),
"EMPIRE" : "beep -l350 -f39.2 -D100 -n -l350 -f39.2 -D100 -n -l350 -f39.2 -D100 -n -l250 -f31.1 -D100 -n -l25 -f46.6 -D100 -n -l350 -f39.2 -D100 -n -l250 -f31.1 -D100 -n -l25 -f46.6 -D100 -n -l700 -f39.2 -D100".split(),
"OCARINA" : "beep -l500 -f44 -n -l1000 -f29.5 -n -l500 -f35 -n -l500 -f44 -n -l1000 -f29.5 -n -l500 -f35 -n -l250 -f44 -n -l250 -f52 -n -l500 -f49 -n -l500 -f39 -n -l250 -f35.5 -n -l250 -f39 -n -l500 -f44 -n -l500 -f29 -n -l250 -f26 -n -l250 -f32.5 -n -l750 -f29".split(),
}
class Disco( Processor ):
usage = u'!disco <message>'
feature = ('disco',)
addressed = False
def __beep( self, disc ):
try:
p = subprocess.Popen( disc, close_fds=True,
stdout=None,
stderr=None,
stdin=None )
p.wait()
except Exception:
pass
@match(r'^!disco+\s(.*)$')
def disco( self, event, disc ):
self.__beep( beepdisc[ str(disc.capitalize()) ] )
event.addresponse( True )
@match(r'^!pingu$')
def pingu( self, event ):
self.__beep( beepdisc["PINGU"] )
event.addresponse( True )
@match(r'^!fantasy$')
def fantasy( self, event ):
self.__beep( beepdisc["FANTASY"] )
event.addresponse( True )
@match(r'^!empire$')
def empire( self, event ):
self.__beep( beepdisc["EMPIRE"] )
event.addresponse( True )
@match(r'^!ocarina$')
def ocarina(self, event):
self.__beep( beepdisc["OCARINA"] )
event.addresponse( True )