Added some necessary adaptions for bible quiz plugin.
This commit is contained in:
parent
6c90a544b6
commit
f6fd25594f
@ -57,6 +57,8 @@ sub new {
|
||||
'startQuery' => 1,
|
||||
};
|
||||
|
||||
$Self->{Data} = {};
|
||||
|
||||
# load plugins
|
||||
my @Plugins = glob("$FindBin::Bin/Plugins/*");
|
||||
|
||||
@ -92,6 +94,13 @@ sub new {
|
||||
|
||||
$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 $KeyboardMessage;
|
||||
if ( $Param{QueryStep} ) {
|
||||
if ( $Param{KeyboardData} ) {
|
||||
$KeyboardData = $Param{KeyboardData};
|
||||
$KeyboardMessage = $Param{KeyboardMessage} // '';
|
||||
}
|
||||
elsif ( $Param{QueryStep} ) {
|
||||
if ( $Param{QueryStep} eq 'hist' ) {
|
||||
# show next selection
|
||||
}
|
||||
@ -191,8 +204,8 @@ sub build {
|
||||
my $ResponseResult = plain POST(
|
||||
join( '/', ( $Self->{TelegramURL}, $Self->{Token}, 'sendMessage' ) ),
|
||||
{
|
||||
'chat_id' => $Param{Message}{message}{chat}{id},
|
||||
'reply_to_message_id' => $Param{Message}{message}{message_id},
|
||||
'chat_id' => $Param{Message}{message}{chat}{id} || $Param{Message}{chat}{id},
|
||||
'reply_to_message_id' => $Param{Message}{message}{message_id} || $Param{Message}{message_id},
|
||||
'text' => $KeyboardMessage,
|
||||
'reply_markup' => $EncodedKeyboard,
|
||||
}
|
||||
@ -247,9 +260,9 @@ sub processMessage {
|
||||
|
||||
# query trigger branch
|
||||
elsif ( defined $Param{Message}{message} && $Param{Message}{message}{text} && $Param{Message}{message}{text} =~ /\/(?<trigger>$QueryTriggerList)/ ) {
|
||||
$Self->build(
|
||||
Message => $Param{Message},
|
||||
QueryStep => $Param{Message}{callback_query}{data} || '',
|
||||
my $Subname = $+{trigger};
|
||||
$Self->$Subname(
|
||||
Message => $Param{Message},
|
||||
);
|
||||
}
|
||||
|
||||
@ -268,9 +281,9 @@ sub processMessage {
|
||||
else {
|
||||
$Self->{LogObject}
|
||||
->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' ) {
|
||||
$ResponseData = $Self->replyLoveQuote( Message => $Param{Message}{message} );
|
||||
# $ResponseData = $Self->replyLoveQuote( Message => $Param{Message}{message} );
|
||||
}
|
||||
else {
|
||||
$ResponseData->{text} =
|
||||
|
Loading…
Reference in New Issue
Block a user