2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

49_TBot_List: new silentStrt option

git-svn-id: https://svn.fhem.de/fhem/trunk@23455 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
viegener 2021-01-02 00:45:54 +00:00
parent 8b050fc6dc
commit 6af98815d0
2 changed files with 13 additions and 6 deletions

View File

@ -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)

View File

@ -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:"<undef>").":";
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($) {
<br><br>
<li><code>start &lt;telegrambot name&gt; [ &lt;peerid&gt; [ &lt;chatid&gt; ] ]</code><br>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)
</li>
<li><code>silentStart ...</code><br>Similar to start with same parameters to start the dialog silently (no notification)
</li>
<li><code>end &lt;telegrambot name&gt; &lt;peerid&gt;</code><br>Finalize a new dialog for the given peer on the given telegrambot
</li>