From 6af98815d0f0ef3c7882acd1a1ac22015e793edf Mon Sep 17 00:00:00 2001 From: viegener <> Date: Sat, 2 Jan 2021 00:45:54 +0000 Subject: [PATCH] 49_TBot_List: new silentStrt option git-svn-id: https://svn.fhem.de/fhem/trunk@23455 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/49_TBot_List.pm | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 653465b94..d230bee44 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 49_TBot_List: new silentStrt option - change: 49_TBot_List: chat/groupid can be added in start - bugfix: 98_weekprofile: Log ccutype not defined (forum #1113306) - change: Device::Firmata removed, use CPAN version (forum #114552) diff --git a/fhem/FHEM/49_TBot_List.pm b/fhem/FHEM/49_TBot_List.pm index 1a8685d62..e2640e963 100644 --- a/fhem/FHEM/49_TBot_List.pm +++ b/fhem/FHEM/49_TBot_List.pm @@ -88,7 +88,7 @@ # show entry content in response for add/del # start list with peerid und chatid als Parameter - +# add silentstart as additional set option to start the chat silent # ############################################################################## # TASKS @@ -253,7 +253,7 @@ sub TBot_List_Set($@) Log3 $name, 4, "TBot_List_Set $name: Processing TBot_List_Set( $cmd ) - args :".(defined($addArg)?$addArg:"").":"; - if ($cmd eq 'start') { + if ( ($cmd eq 'start') || ($cmd eq 'silentStart') ) { Log3 $name, 4, "TBot_List_Set $name: start of dialog requested "; $ret = "start requires a telegrambot and optionally a peer" if ( ( $numberOfArgs < 2 ) && ( $numberOfArgs > 3 ) ); @@ -298,7 +298,9 @@ sub TBot_List_Set($@) # start uses a botname and an optional peer $tpeer .= " ".$tchat if ( defined( $tchat ) ); - $ret = TBot_List_handler( $hash, "list", $tbot, $tpeer ) if ( ! $ret ); + my $lstcmd = ($cmd eq 'silentStart')?"list":"listsilent"; + + $ret = TBot_List_handler( $hash, $lstcmd, $tbot, $tpeer ) if ( ! $ret ); } elsif($cmd eq 'end') { Log3 $name, 4, "TBot_List_Set $name: end of dialog requested "; @@ -803,7 +805,7 @@ sub TBot_List_handler($$$$;$) } ##################### - } elsif ( ( $cmd eq "list" ) || ( $cmd eq "list_edit" ) ) { + } elsif ( ( $cmd eq "list" ) || ( $cmd eq "listsilent" ) || ( $cmd eq "list_edit" ) ) { # list means create button table with list entries # start the inline @@ -843,7 +845,7 @@ sub TBot_List_handler($$$$;$) $textmsg .= " ist leer " if ( scalar(@list) == 0 ); $textmsg .= " : $arg " if ( defined($arg) ); - if ( $cmd eq "list" ) { + if ( ( $cmd eq "list" ) || ( $cmd eq "listsilent" ) ){ # remove msgId if existing if ( defined($msgId ) ) { @@ -862,7 +864,8 @@ sub TBot_List_handler($$$$;$) TBot_List_setMsgId( $hash, $tbot, $peer, $chatId, "chat" ); # send msg and keys - AnalyzeCommandChain( $hash, "set ".$tbot." queryInline ".'@'.$chatId." $inline $textmsg" ); + my $tbotset = ( $cmd eq "list" )?"queryInline":"silentInline"; + AnalyzeCommandChain( $hash, "set ".$tbot." ".$tbotset." ".'@'.$chatId." $inline $textmsg" ); } else { if ( defined($msgId ) ) { @@ -1281,6 +1284,7 @@ sub TBot_List_Setup($) { my %sets = ( "start" => undef, + "silentStart" => undef, "end" => undef, "reset" => undef, @@ -1357,6 +1361,8 @@ sub TBot_List_Setup($) {

  • start <telegrambot name> [ <peerid> [ <chatid> ] ]
    Initiate a new dialog for the given peer (or the last peer sending a message on the given telegrambot - if communication should happen in a group then both chatid with the groupid and peerid with the user id need to be specified)
  • +
  • silentStart ...
    Similar to start with same parameters to start the dialog silently (no notification) +
  • end <telegrambot name> <peerid>
    Finalize a new dialog for the given peer on the given telegrambot