forked from profanity-im/profanity-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
say.py
58 lines (50 loc) · 1.47 KB
/
say.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
import prof
import os
from sys import platform
enabled = False
def say(message):
if platform == "darwin":
os.system("say '" + message + "' 2>/dev/null")
elif platform == "linux" or platform == "linux2":
os.system("echo '" + message + "' | espeak 2>/dev/null")
def prof_post_chat_message_display(jid, message):
global enabled
if enabled:
say(jid + " says " + message)
return message
def prof_post_room_message_display(room, nick, message):
global enabled
if enabled:
say(nick + " says " + message + " in " + room)
return message
def prof_post_priv_message_display(room, nick, message):
global enabled
if enabled:
say(nick + " says " + message)
return message
def _cmd_say(arg1=None, arg2=None):
global enabled
if arg1 == "on":
enabled = True
elif arg1 == "off":
enabled = False
elif arg1 == "test":
if arg2 == None:
prof.cons_bad_cmd_usage("/say")
else:
say(arg2)
else:
prof.cons_bad_cmd_usage("/say")
def prof_init(version, status):
synopsis = [
"/say on|off",
"/say test <message>"
]
description = "Read all messages out loud"
args = [
[ "on|off", "Enable/disable say" ],
[ "test <message>", "Say message" ]
]
examples = []
prof.register_command("/say", 1, 2, synopsis, description, args, examples, _cmd_say)
prof.register_ac("/say", [ "on", "off", "test" ])