Added speak_all_private_messages and the script now uses spd-say, not espeak-ng to prevent speaking over itself!
This commit is contained in:
+18
-4
@@ -44,8 +44,9 @@ sub speak_message {
|
||||
$body = decode(ENCODING, $body);
|
||||
my $SpeechRate = Irssi::settings_get_int("speech_rate");
|
||||
my $SpeechVoice = Irssi::settings_get_str("speech_voice");
|
||||
my $SpeechModule = Irssi::settings_get_str("speech_module");
|
||||
# Speak The Message
|
||||
system("espeak-ng -v $SpeechVoice -s $SpeechRate \"$summary $body\"&");
|
||||
system("spd-say -P important -y $SpeechVoice -r $SpeechRate -o $SpeechModule \"$summary $body\"&");
|
||||
}
|
||||
|
||||
# Handle incoming public messages:
|
||||
@@ -67,12 +68,23 @@ sub message_public {
|
||||
# Get the user's nick name:
|
||||
my $user = $server->{nick};
|
||||
|
||||
#check to notify about all messages:
|
||||
if ((Irssi::settings_get_bool('speak_all_public_messages')) == 1) {
|
||||
# Get the server's tag:
|
||||
my $tag = $server->{tag};
|
||||
|
||||
# Prepare the message body:
|
||||
(my $body = $message) =~ s/^$user[\s:,]\s*//;
|
||||
|
||||
# Notify the user about the incoming public message:
|
||||
speak_message("Message from $nick/$tag on $target:", $body);
|
||||
}
|
||||
# Check whether to notify the user about indirect messages:
|
||||
unless (Irssi::settings_get_bool('speak_indirect_messages')) {
|
||||
elsif ((Irssi::settings_get_bool('speak_indirect_messages')) == 0) {
|
||||
# Ignore messages that are not explicitly addressed to the user:
|
||||
return if ($message !~ /^$user[\s:,]/);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
# Ignore messages that do not mention the user:
|
||||
return if ($message !~ /\b$user\b/);
|
||||
}
|
||||
@@ -177,10 +189,12 @@ sub dcc_chat_message {
|
||||
}
|
||||
|
||||
# Register configuration options:
|
||||
Irssi::settings_add_int("autospeak", "speech_rate", 175);
|
||||
Irssi::settings_add_int("autospeak", "speech_rate", 50);
|
||||
Irssi::settings_add_str("autospeak", "speech_voice", "en-us");
|
||||
Irssi::settings_add_str("autospeak", "speech_module", "espeak-ng");
|
||||
Irssi::settings_add_bool('autospeak', 'speak_private_messages', 1);
|
||||
Irssi::settings_add_bool('autospeak', 'speak_public_messages', 1);
|
||||
Irssi::settings_add_bool('autospeak', 'speak_all_public_messages', 0);
|
||||
Irssi::settings_add_bool('autospeak', 'speak_indirect_messages',0);
|
||||
Irssi::settings_add_bool('autospeak', 'speak_active_window', 0);
|
||||
Irssi::settings_add_bool('autospeak', 'speak_dcc_messages', 1);
|
||||
|
||||
Reference in New Issue
Block a user