Added some necessary adaptions for bible quiz plugin.
This commit is contained in:
		@@ -57,6 +57,8 @@ sub new {
 | 
				
			|||||||
        'startQuery' => 1,
 | 
					        'startQuery' => 1,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $Self->{Data} = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # load plugins
 | 
					    # load plugins
 | 
				
			||||||
    my @Plugins = glob("$FindBin::Bin/Plugins/*");
 | 
					    my @Plugins = glob("$FindBin::Bin/Plugins/*");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -92,6 +94,13 @@ sub new {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                $Self->{QueryTrigger}{$PluginQueryTrigger} = $PluginQueryTriggerList->{$PluginQueryTrigger};
 | 
					                $Self->{QueryTrigger}{$PluginQueryTrigger} = $PluginQueryTriggerList->{$PluginQueryTrigger};
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            # import module data
 | 
				
			||||||
 | 
					            my $PluginData = $PluginObject->getData();
 | 
				
			||||||
 | 
					            $Self->{Data} = {
 | 
				
			||||||
 | 
					                $Self->{Data}->%*,
 | 
				
			||||||
 | 
					                $PluginData->%*,
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -144,7 +153,11 @@ sub build {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    my $KeyboardData;
 | 
					    my $KeyboardData;
 | 
				
			||||||
    my $KeyboardMessage;
 | 
					    my $KeyboardMessage;
 | 
				
			||||||
    if ( $Param{QueryStep} ) {
 | 
					    if ( $Param{KeyboardData} ) {
 | 
				
			||||||
 | 
					        $KeyboardData    = $Param{KeyboardData};
 | 
				
			||||||
 | 
					        $KeyboardMessage = $Param{KeyboardMessage} // '';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    elsif ( $Param{QueryStep} ) {
 | 
				
			||||||
        if ( $Param{QueryStep} eq 'hist' ) {
 | 
					        if ( $Param{QueryStep} eq 'hist' ) {
 | 
				
			||||||
            # show next selection
 | 
					            # show next selection
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -191,8 +204,8 @@ sub build {
 | 
				
			|||||||
    my $ResponseResult = plain POST(
 | 
					    my $ResponseResult = plain POST(
 | 
				
			||||||
        join( '/', ( $Self->{TelegramURL}, $Self->{Token}, 'sendMessage' ) ),
 | 
					        join( '/', ( $Self->{TelegramURL}, $Self->{Token}, 'sendMessage' ) ),
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            'chat_id'             => $Param{Message}{message}{chat}{id},
 | 
					            'chat_id'             => $Param{Message}{message}{chat}{id} || $Param{Message}{chat}{id},
 | 
				
			||||||
            'reply_to_message_id' => $Param{Message}{message}{message_id},
 | 
					            'reply_to_message_id' => $Param{Message}{message}{message_id} || $Param{Message}{message_id},
 | 
				
			||||||
            'text'                => $KeyboardMessage,
 | 
					            'text'                => $KeyboardMessage,
 | 
				
			||||||
            'reply_markup'        => $EncodedKeyboard,
 | 
					            'reply_markup'        => $EncodedKeyboard,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -247,9 +260,9 @@ sub processMessage {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # query trigger branch
 | 
					    # query trigger branch
 | 
				
			||||||
    elsif ( defined $Param{Message}{message} && $Param{Message}{message}{text} && $Param{Message}{message}{text} =~ /\/(?<trigger>$QueryTriggerList)/ ) {
 | 
					    elsif ( defined $Param{Message}{message} && $Param{Message}{message}{text} && $Param{Message}{message}{text} =~ /\/(?<trigger>$QueryTriggerList)/ ) {
 | 
				
			||||||
        $Self->build(
 | 
					        my $Subname = $+{trigger};
 | 
				
			||||||
            Message   => $Param{Message},
 | 
					        $Self->$Subname(
 | 
				
			||||||
            QueryStep => $Param{Message}{callback_query}{data} || '',
 | 
					            Message => $Param{Message},
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -268,9 +281,9 @@ sub processMessage {
 | 
				
			|||||||
    else {
 | 
					    else {
 | 
				
			||||||
        $Self->{LogObject}
 | 
					        $Self->{LogObject}
 | 
				
			||||||
          ->debug( 'Command not recognized. Data: ' . $Param{Message}{message}{text} );
 | 
					          ->debug( 'Command not recognized. Data: ' . $Param{Message}{message}{text} );
 | 
				
			||||||
        if ( $Self->{Whitelist}{$Param{Message}{message}{from}{id}} eq 'Sarah'
 | 
					        if ( 0 && $Self->{Whitelist}{$Param{Message}{message}{from}{id}} eq 'Sarah'
 | 
				
			||||||
            || $Self->{Whitelist}{$Param{Message}{message}{from}{id}} eq 'Stefan' ) {
 | 
					            || $Self->{Whitelist}{$Param{Message}{message}{from}{id}} eq 'Stefan' ) {
 | 
				
			||||||
            $ResponseData = $Self->replyLoveQuote( Message => $Param{Message}{message} );
 | 
					            # $ResponseData = $Self->replyLoveQuote( Message => $Param{Message}{message} );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            $ResponseData->{text} =
 | 
					            $ResponseData->{text} =
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user