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@20588 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2019-11-25 19:41:41 +00:00
parent 91775e4eff
commit 16367d9cf4

View File

@ -80,7 +80,7 @@ sub SSChatBot_Initialize($) {
$hash->{FW_deviceOverview} = 1; $hash->{FW_deviceOverview} = 1;
$hash->{AttrList} = "disable:1,0 ". $hash->{AttrList} = "disable:1,0 ".
"recepUser:--wait#for#userlist-- ". "defaultPeer:--wait#for#userlist-- ".
"showTokenInLog:1,0 ". "showTokenInLog:1,0 ".
"httptimeout ". "httptimeout ".
$readingFnAttributes; $readingFnAttributes;
@ -309,9 +309,9 @@ sub SSChatBot_Set($@) {
return "Your sendstring is incorrect. It must contain at least the \"text\" tag like 'text=\"...\" '." if(!$text); return "Your sendstring is incorrect. It must contain at least the \"text\" tag like 'text=\"...\" '." if(!$text);
$users = AttrVal($name,"recepUser", "") if(!$users); $users = AttrVal($name,"defaultPeer", "") if(!$users);
return "You haven't defined any receptor for send the message to. ". return "You haven't defined any receptor for send the message to. ".
"You have to use the \"users\" tag or define default receptors with attribute \"recepUser\"." if(!$users); "You have to use the \"users\" tag or define default receptors with attribute \"defaultPeer\"." if(!$users);
# User aufsplitten und zu jedem die ID ermitteln # User aufsplitten und zu jedem die ID ermitteln
my @ua = split(/,/, $users); my @ua = split(/,/, $users);
@ -765,7 +765,12 @@ sub SSChatBot_chatop ($) {
$url .= "}"; $url .= "}";
} }
Log3($name, 4, "$name - Call-Out: $url"); my $part = (split("&token=", $url))[0];
if(AttrVal($name, "showTokenInLog", "0") == 1) {
Log3($name, 4, "$name - Call-Out: $url");
} else {
Log3($name, 4, "$name - Call-Out: $part&token=<secret>");
}
$param = { $param = {
url => $url, url => $url,
@ -853,15 +858,16 @@ sub SSChatBot_chatop_parse ($) {
$i++; $i++;
} }
$hash->{HELPER}{USERS} = \%users if(%users); $hash->{HELPER}{USERS} = \%users if(%users);
my @newa; my @newa;
my @deva = split(" ", $hash->{".AttrList"}); my $list = $modules{$hash->{TYPE}}{AttrList};
my @deva = split(" ", $list);
foreach (@deva) { foreach (@deva) {
push @newa, $_ if($_ !~ /recepUser/); push @newa, $_ if($_ !~ /defaultPeer:/);
} }
push @newa, ($uids?"recepUser:multiple-strict,$uids ":"recepUser:--no#userlist#selectable-- "); push @newa, ($uids?"defaultPeer:multiple-strict,$uids ":"defaultPeer:--no#userlist#selectable--");
$hash->{".AttrList"} = join(" ", @newa); $hash->{".AttrList"} = join(" ", @newa); # Device spezifische AttrList, überschreibt Modul AttrList !
$out .= "</table>"; $out .= "</table>";
$out .= "</html>"; $out .= "</html>";