2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 16:56:04 +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->{AttrList} = "disable:1,0 ".
"recepUser:--wait#for#userlist-- ".
"defaultPeer:--wait#for#userlist-- ".
"showTokenInLog:1,0 ".
"httptimeout ".
$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);
$users = AttrVal($name,"recepUser", "") if(!$users);
$users = AttrVal($name,"defaultPeer", "") if(!$users);
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
my @ua = split(/,/, $users);
@ -765,7 +765,12 @@ sub SSChatBot_chatop ($) {
$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 = {
url => $url,
@ -853,15 +858,16 @@ sub SSChatBot_chatop_parse ($) {
$i++;
}
$hash->{HELPER}{USERS} = \%users if(%users);
my @newa;
my @deva = split(" ", $hash->{".AttrList"});
my $list = $modules{$hash->{TYPE}}{AttrList};
my @deva = split(" ", $list);
foreach (@deva) {
push @newa, $_ if($_ !~ /recepUser/);
push @newa, $_ if($_ !~ /defaultPeer:/);
}
push @newa, ($uids?"recepUser:multiple-strict,$uids ":"recepUser:--no#userlist#selectable-- ");
$hash->{".AttrList"} = join(" ", @newa);
push @newa, ($uids?"defaultPeer:multiple-strict,$uids ":"defaultPeer:--no#userlist#selectable--");
$hash->{".AttrList"} = join(" ", @newa); # Device spezifische AttrList, überschreibt Modul AttrList !
$out .= "</table>";
$out .= "</html>";