2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 04:36:36 +00:00

50_SSChatBot: contrib 1.5.0

git-svn-id: https://svn.fhem.de/fhem/trunk@21432 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2020-03-15 19:02:52 +00:00
parent c45ca1f4b0
commit ce2712f0a5

View File

@ -49,6 +49,7 @@ eval "use Net::Domain qw(hostname hostfqdn hostdomain domainname);1" or my $SSC
# Versions History intern
our %SSChatBot_vNotesIntern = (
"1.5.0" => "15.03.2020 slash commands set in interactive answer field 'value' will be executed ",
"1.4.0" => "15.03.2020 rename '1_sendItem' to 'asyncSendItem' because of Aesthetics ",
"1.3.1" => "14.03.2020 new reading recActionsValue which extract the value from actions, review logs of SSChatBot_CGI ",
"1.3.0" => "13.03.2020 rename 'sendItem' to '1_sendItem', allow attachments ",
@ -1577,7 +1578,7 @@ sub SSChatBot_CGI() {
my ($request) = @_;
my ($hash,$name,$link,$args);
my ($text,$timestamp,$channelid,$channelname,$userid,$username,$postid,$triggerword) = ("","","","","","","","");
my ($command,$cr,$au,$arg,$callbackid,$actions,$actval) = ("","","","","","","");
my ($command,$cr,$au,$arg,$callbackid,$actions,$actval,$avToExec) = ("","","","","","","","");
my $success;
my @aul;
my $state = "active";
@ -1699,14 +1700,20 @@ sub SSChatBot_CGI() {
$callbackid = $h->{callback_id} if($h->{callback_id});
$timestamp = $h->{timestamp} if($h->{timestamp});
# interaktive Schaltflächen (Aktionen) auswerten
if ($h->{actions}) {
$actions = $h->{actions};
$actions =~ m/^type: button.*value: (.*), text:.*$/;
$actval = $1;
if($actval =~ /^\/.*$/) {
Log3($name, 4, "$name - slash command \"$actval\" got from interactive data and execute it with priority");
$avToExec = $actval;
}
}
if ($h->{text}) {
$text = $h->{text};
if ($h->{text} || $avToExec) {
$text = $h->{text};
$text = $avToExec if($avToExec); # Vorrang für empfangene interaktive Data (Schaltflächenwerte) die Slash-Befehle enthalten
if($text =~ /^\/([Ss]et.*?|[Gg]et.*?|[Cc]ode.*?)\s+(.*)$/) { # vordefinierte Befehle in FHEM ausführen
my $p1 = $1;
my $p2 = $2;