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

50_SSChatBot: contrib 1.0.0

git-svn-id: https://svn.fhem.de/fhem/trunk@20657 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2019-12-04 20:27:05 +00:00
parent 62345c2323
commit fd237ac08a

View File

@ -1588,11 +1588,6 @@ sub SSChatBot_CGI() {
$text = urlDecode($h->{text});
Log3($name, 4, "$name - text received: ".$text);
my $uc = AttrVal($name,"ownCommand", ""); # User Commands zusammenstellen
if ($uc) {
($uc,$arg) = split(" ", $uc, 2);
}
if($text =~ /^\/([Ss]et.*?|[Gg]et.*?|[Cc]ode.*?)\s+(.*)$/) { # vordefinierte Befehle in FHEM ausführen
my $p1 = $1;
my $p2 = $2;
@ -1654,7 +1649,14 @@ sub SSChatBot_CGI() {
InternalTimer(gettimeofday()+1, "SSChatBot_getapisites", "$name", 0);
}
if($uc && $uc =~ /^$text(\s+)?$/) { # User eigene Befehle, z.B.: /Wetter
my $uc = AttrVal($name,"ownCommand", ""); # User Commands zusammenstellen
if ($uc) {
my @cmda = split(",", $uc);
foreach my $cmd (@cmda) {
$cmd = SSChatBot_trim($cmd);
($uc,$arg) = split(":", $cmd, 2);
if($uc && $text =~ /^$uc\s?$/) { # User eigene Slash-Befehle, z.B.: /Wetter
$au = AttrVal($name,"allowedUserForOwn", "all");
@aul = split(",",$au);
if($au eq "all" || $username ~~ @aul) {
@ -1672,10 +1674,13 @@ sub SSChatBot_CGI() {
$cr = SSChatBot_formText($cr);
SSChatBot_addQueue($name, "sendItem", "chatbot", $userid, $cr, "", "", "");
}
}
RemoveInternalTimer($hash, "SSChatBot_getapisites");
InternalTimer(gettimeofday()+1, "SSChatBot_getapisites", "$name", 0);
}
}
if ($h->{trigger_word}) {