view release on metacpan or search on metacpan
lib/EV/Telegram/TDLib/Bots.pm view on Meta::CPAN
chat_id => 0 + ($opt{chat_id} // $bot),
parameter => defined $parameter ? "$parameter" : '' }, $cb);
return;
}
sub attachment_menu_bot {
my ($self, @args) = @_;
my $cb = ref $args[-1] eq 'CODE' ? pop @args : sub {};
my ($bot, @rest) = @args;
_need('bot_user_id', $bot);
$self->send({ '@type' => 'getAttachmentMenuBot', bot_user_id => 0 + $bot }, $cb);
return;
}
# openWebApp with an empty url needs the bot to be in the attachment menu
sub toggle_attachment_menu {
my ($self, @args) = @_;
my $cb = ref $args[-1] eq 'CODE' ? pop @args : sub {};
my ($bot, $on, @rest) = @args;
my %opt = @rest;
_need('bot_user_id', $bot);
$self->send({ '@type' => 'toggleBotIsAddedToAttachmentMenu',
bot_user_id => 0 + $bot,
is_added => _json_bool(defined $on ? $on : 1),
allow_write_access => _json_bool($opt{allow_write_access}) }, $cb);
return;
}
# the user's answer to a request_chat / request_users keyboard button; the
# source identifies the message the button was on, and button_id is the id
# you gave that button when building the keyboard
sub _button_source {
lib/EV/Telegram/TDLib/Bots.pm view on Meta::CPAN
}
# the button beside the message box; a web_app url makes it open a Mini App
sub set_menu_button {
my ($self, @args) = @_;
my $cb = ref $args[-1] eq 'CODE' ? pop @args : sub {};
my ($user_id, @rest) = @args;
my %opt = @rest;
$self->send({
'@type' => 'setMenuButton',
user_id => 0 + ($user_id // 0),
menu_button => { '@type' => 'botMenuButton',
text => $opt{text} // '',
url => $opt{url} // '' },
}, $cb);
return;
}
sub menu_button {
my ($self, @args) = @_;
my $cb = ref $args[-1] eq 'CODE' ? pop @args : sub {};
my ($user_id, @rest) = @args;
$self->send({ '@type' => 'getMenuButton', user_id => 0 + ($user_id // 0) }, $cb);
return;
}
1;
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
getAccountTtl => '',
getActiveSessions => '',
getAllPassportElements => 'password',
getAllStickerEmojis => 'sticker_type query chat_id return_only_main_emoji',
getAnimatedEmoji => 'emoji',
getApplicationConfig => '',
getApplicationDownloadLink => '',
getArchiveChatListSettings => '',
getArchivedStickerSets => 'sticker_type offset_sticker_set_id limit',
getAttachedStickerSets => 'file_id',
getAttachmentMenuBot => 'bot_user_id',
getAuthenticationPasskeyParameters => '',
getAuthorizationState => '',
getAutoDownloadSettingsPresets => '',
getAutosaveSettings => '',
getAvailableChatBoostSlots => '',
getAvailableGifts => '',
getBackgroundUrl => 'name type',
getBankCardInfo => 'bank_card_number',
getBasicGroup => 'basic_group_id',
getBasicGroupFullInfo => 'basic_group_id',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
getLogVerbosityLevel => '',
getLoginPasskeys => '',
getLoginUrl => 'chat_id message_id button_id allow_write_access',
getLoginUrlInfo => 'chat_id message_id button_id',
getMainWebApp => 'chat_id bot_user_id start_parameter parameters',
getManagedBotAccessSettings => 'bot_user_id',
getManagedBotToken => 'bot_user_id revoke',
getMapThumbnailFile => 'location zoom width height scale chat_id',
getMarkdownText => 'text',
getMe => '',
getMenuButton => 'user_id',
getMessage => 'chat_id message_id',
getMessageAddedReactions => 'chat_id message_id reaction_type offset limit',
getMessageAuthor => 'chat_id message_id',
getMessageAvailableReactions => 'chat_id message_id row_size',
getMessageEffect => 'effect_id',
getMessageEmbeddingCode => 'chat_id message_id for_album',
getMessageFileType => 'message_file_head',
getMessageImportConfirmationText => 'chat_id',
getMessageLink => 'chat_id message_id media_timestamp checklist_task_id poll_option_id for_album in_message_thread',
getMessageLinkInfo => 'url',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
setGroupCallParticipantVolumeLevel => 'group_call_id participant_id volume_level',
setInactiveSessionTtl => 'inactive_session_ttl_days',
setInlineGameScore => 'inline_message_id edit_message user_id score force',
setLiveStoryMessageSender => 'group_call_id message_sender_id',
setLogStream => 'log_stream',
setLogTagVerbosityLevel => 'tag new_verbosity_level',
setLogVerbosityLevel => 'new_verbosity_level',
setLoginEmailAddress => 'new_login_email_address',
setMainProfileTab => 'main_profile_tab',
setManagedBotAccessSettings => 'bot_user_id settings',
setMenuButton => 'user_id menu_button',
setMessageFactCheck => 'chat_id message_id text',
setMessageReactions => 'chat_id message_id reaction_types is_big',
setMessageSenderBlockList => 'sender_id block_list',
setMessageSenderBotVerification => 'bot_user_id verified_id custom_description',
setName => 'first_name last_name',
setNetworkType => 'type',
setNewChatPrivacySettings => 'settings',
setOption => 'name value',
setPaidMessageReactionType => 'chat_id message_id type',
setPassportElement => 'element password',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
testCallVectorString => 'x',
testCallVectorStringObject => 'x',
testGetDifference => '',
testNetwork => '',
testProxy => 'proxy dc_id timeout',
testReturnError => 'error',
testSquareInt => 'x',
testUseUpdate => '',
toggleAllDownloadsArePaused => 'are_paused',
toggleBotCanManageEmojiStatus => 'bot_user_id can_manage_emoji_status',
toggleBotIsAddedToAttachmentMenu => 'bot_user_id is_added allow_write_access',
toggleBotUsernameIsActive => 'bot_user_id username is_active',
toggleBusinessConnectedBotChatIsPaused => 'chat_id is_paused',
toggleChatDefaultDisableNotification => 'chat_id default_disable_notification',
toggleChatFolderTags => 'are_tags_enabled',
toggleChatGiftNotifications => 'chat_id are_enabled',
toggleChatHasProtectedContent => 'chat_id has_protected_content',
toggleChatIsMarkedAsUnread => 'chat_id is_marked_as_unread',
toggleChatIsPinned => 'chat_list chat_id is_pinned',
toggleChatIsTranslatable => 'chat_id is_translatable',
toggleChatViewAsTopics => 'chat_id view_as_topics',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
answerCustomQuery => 'Function',
answerGuestQuery => 'Function',
answerInlineQuery => 'Function',
answerPreCheckoutQuery => 'Function',
answerShippingQuery => 'Function',
answerWebAppQuery => 'Function',
applyPremiumGiftCode => 'Function',
approveSuggestedPost => 'Function',
archiveChatListSettings => 'Object',
assignStoreTransaction => 'Function',
attachmentMenuBot => 'Object',
attachmentMenuBotColor => 'Object',
attributeCraftPersistenceProbability => 'Object',
auctionBid => 'Object',
auctionRound => 'Object',
auctionStateActive => 'AuctionState',
auctionStateFinished => 'AuctionState',
audio => 'Object',
audios => 'Object',
authenticationCodeInfo => 'Object',
authenticationCodeTypeCall => 'AuthenticationCodeType',
authenticationCodeTypeFirebaseAndroid => 'AuthenticationCodeType',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
botCommandScopeAllPrivateChats => 'BotCommandScope',
botCommandScopeChat => 'BotCommandScope',
botCommandScopeChatAdministrators => 'BotCommandScope',
botCommandScopeChatMember => 'BotCommandScope',
botCommandScopeDefault => 'BotCommandScope',
botCommands => 'Object',
botInfo => 'Object',
botMediaPreview => 'Object',
botMediaPreviewInfo => 'Object',
botMediaPreviews => 'Object',
botMenuButton => 'Object',
botVerification => 'Object',
botVerificationParameters => 'Object',
botWriteAccessAllowReasonAcceptedRequest => 'BotWriteAccessAllowReason',
botWriteAccessAllowReasonAddedToAttachmentMenu => 'BotWriteAccessAllowReason',
botWriteAccessAllowReasonConnectedWebsite => 'BotWriteAccessAllowReason',
botWriteAccessAllowReasonLaunchedWebApp => 'BotWriteAccessAllowReason',
builtInThemeArctic => 'BuiltInTheme',
builtInThemeClassic => 'BuiltInTheme',
builtInThemeDay => 'BuiltInTheme',
builtInThemeNight => 'BuiltInTheme',
builtInThemeTinted => 'BuiltInTheme',
businessAwayMessageScheduleAlways => 'BusinessAwayMessageSchedule',
businessAwayMessageScheduleCustom => 'BusinessAwayMessageSchedule',
businessAwayMessageScheduleOutsideOfOpeningHours => 'BusinessAwayMessageSchedule',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
getAccountTtl => 'Function',
getActiveSessions => 'Function',
getAllPassportElements => 'Function',
getAllStickerEmojis => 'Function',
getAnimatedEmoji => 'Function',
getApplicationConfig => 'Function',
getApplicationDownloadLink => 'Function',
getArchiveChatListSettings => 'Function',
getArchivedStickerSets => 'Function',
getAttachedStickerSets => 'Function',
getAttachmentMenuBot => 'Function',
getAuthenticationPasskeyParameters => 'Function',
getAuthorizationState => 'Function',
getAutoDownloadSettingsPresets => 'Function',
getAutosaveSettings => 'Function',
getAvailableChatBoostSlots => 'Function',
getAvailableGifts => 'Function',
getBackgroundUrl => 'Function',
getBankCardInfo => 'Function',
getBasicGroup => 'Function',
getBasicGroupFullInfo => 'Function',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
getLogVerbosityLevel => 'Function',
getLoginPasskeys => 'Function',
getLoginUrl => 'Function',
getLoginUrlInfo => 'Function',
getMainWebApp => 'Function',
getManagedBotAccessSettings => 'Function',
getManagedBotToken => 'Function',
getMapThumbnailFile => 'Function',
getMarkdownText => 'Function',
getMe => 'Function',
getMenuButton => 'Function',
getMessage => 'Function',
getMessageAddedReactions => 'Function',
getMessageAuthor => 'Function',
getMessageAvailableReactions => 'Function',
getMessageEffect => 'Function',
getMessageEmbeddingCode => 'Function',
getMessageFileType => 'Function',
getMessageImportConfirmationText => 'Function',
getMessageLink => 'Function',
getMessageLinkInfo => 'Function',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
inputStoryAreaTypeWeather => 'InputStoryAreaType',
inputStoryAreas => 'Object',
inputStoryContentPhoto => 'InputStoryContent',
inputStoryContentVideo => 'InputStoryContent',
inputSuggestedPostInfo => 'Object',
inputTextQuote => 'Object',
inputThumbnail => 'Object',
inputVideo => 'Object',
inputVideoNote => 'Object',
inputVoiceNote => 'Object',
internalLinkTypeAttachmentMenuBot => 'InternalLinkType',
internalLinkTypeAuthenticationCode => 'InternalLinkType',
internalLinkTypeBackground => 'InternalLinkType',
internalLinkTypeBotAddToChannel => 'InternalLinkType',
internalLinkTypeBotStart => 'InternalLinkType',
internalLinkTypeBotStartInGroup => 'InternalLinkType',
internalLinkTypeBusinessChat => 'InternalLinkType',
internalLinkTypeCallsPage => 'InternalLinkType',
internalLinkTypeChatAffiliateProgram => 'InternalLinkType',
internalLinkTypeChatBoost => 'InternalLinkType',
internalLinkTypeChatFolderInvite => 'InternalLinkType',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
setGroupCallParticipantVolumeLevel => 'Function',
setInactiveSessionTtl => 'Function',
setInlineGameScore => 'Function',
setLiveStoryMessageSender => 'Function',
setLogStream => 'Function',
setLogTagVerbosityLevel => 'Function',
setLogVerbosityLevel => 'Function',
setLoginEmailAddress => 'Function',
setMainProfileTab => 'Function',
setManagedBotAccessSettings => 'Function',
setMenuButton => 'Function',
setMessageFactCheck => 'Function',
setMessageReactions => 'Function',
setMessageSenderBlockList => 'Function',
setMessageSenderBotVerification => 'Function',
setName => 'Function',
setNetworkType => 'Function',
setNewChatPrivacySettings => 'Function',
setOption => 'Function',
setPaidMessageReactionType => 'Function',
setPassportElement => 'Function',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
thumbnailFormatJpeg => 'ThumbnailFormat',
thumbnailFormatMpeg4 => 'ThumbnailFormat',
thumbnailFormatPng => 'ThumbnailFormat',
thumbnailFormatTgs => 'ThumbnailFormat',
thumbnailFormatWebm => 'ThumbnailFormat',
thumbnailFormatWebp => 'ThumbnailFormat',
timeZone => 'Object',
timeZones => 'Object',
toggleAllDownloadsArePaused => 'Function',
toggleBotCanManageEmojiStatus => 'Function',
toggleBotIsAddedToAttachmentMenu => 'Function',
toggleBotUsernameIsActive => 'Function',
toggleBusinessConnectedBotChatIsPaused => 'Function',
toggleChatDefaultDisableNotification => 'Function',
toggleChatFolderTags => 'Function',
toggleChatGiftNotifications => 'Function',
toggleChatHasProtectedContent => 'Function',
toggleChatIsMarkedAsUnread => 'Function',
toggleChatIsPinned => 'Function',
toggleChatIsTranslatable => 'Function',
toggleChatViewAsTopics => 'Function',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
updateAccentColors => 'Update',
updateActiveEmojiReactions => 'Update',
updateActiveGiftAuctions => 'Update',
updateActiveLiveLocationMessages => 'Update',
updateActiveNotifications => 'Update',
updateAgeVerificationParameters => 'Update',
updateAnimatedEmojiMessageClicked => 'Update',
updateAnimationSearchParameters => 'Update',
updateApplicationRecaptchaVerificationRequired => 'Update',
updateApplicationVerificationRequired => 'Update',
updateAttachmentMenuBots => 'Update',
updateAuthorizationState => 'Update',
updateAutosaveSettings => 'Update',
updateAvailableMessageEffects => 'Update',
updateBasicGroup => 'Update',
updateBasicGroupFullInfo => 'Update',
updateBusinessConnection => 'Update',
updateBusinessMessageEdited => 'Update',
updateBusinessMessagesDeleted => 'Update',
updateCall => 'Update',
updateChatAccentColors => 'Update',
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
animatedChatPhoto => { file => 'file' },
animatedEmoji => { sound => 'file', sticker => 'sticker' },
animation => { animation => 'file', minithumbnail => 'minithumbnail', thumbnail => 'thumbnail' },
animations => { animations => 'array:animation' },
answerChatJoinRequestQuery => { result => 'ChatJoinRequestResult' },
answerGuestQuery => { result => 'InputInlineQueryResult' },
answerInlineQuery => { button => 'inlineQueryResultsButton', results => 'array:InputInlineQueryResult' },
answerShippingQuery => { shipping_options => 'array:shippingOption' },
answerWebAppQuery => { result => 'InputInlineQueryResult' },
assignStoreTransaction => { purpose => 'StorePaymentPurpose', transaction => 'StoreTransaction' },
attachmentMenuBot => { android_icon => 'file', android_side_menu_icon => 'file', default_icon => 'file', icon_color => 'attachmentMenuBotColor', ios_animated_icon => 'file', ios_side_menu_icon => 'file', ios_static_ic...
auctionStateActive => { bid_levels => 'array:auctionBid', rounds => 'array:auctionRound', user_bid => 'userAuctionBid' },
audio => { album_cover_minithumbnail => 'minithumbnail', album_cover_thumbnail => 'thumbnail', audio => 'file', external_album_covers => 'array:thumbnail' },
audios => { audios => 'array:audio' },
authenticationCodeInfo => { next_type => 'AuthenticationCodeType', type => 'AuthenticationCodeType' },
authenticationCodeTypeFirebaseAndroid => { device_verification_parameters => 'FirebaseDeviceVerificationParameters' },
authorizationStateWaitCode => { code_info => 'authenticationCodeInfo' },
authorizationStateWaitEmailCode => { code_info => 'emailAddressAuthenticationCodeInfo', email_address_reset_state => 'EmailAddressResetState' },
authorizationStateWaitRegistration => { terms_of_service => 'termsOfService' },
autoDownloadSettingsPresets => { high => 'autoDownloadSettings', low => 'autoDownloadSettings', medium => 'autoDownloadSettings' },
autosaveSettings => { channel_settings => 'scopeAutosaveSettings', exceptions => 'array:autosaveSettingsException', group_settings => 'scopeAutosaveSettings', private_chat_settings => 'scopeAutosaveSettings' },
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
availableReactions => { popular_reactions => 'array:availableReaction', recent_reactions => 'array:availableReaction', top_reactions => 'array:availableReaction', unavailability_reason => 'ReactionUnavailabilityReason'...
background => { document => 'document', type => 'BackgroundType' },
backgroundTypeFill => { fill => 'BackgroundFill' },
backgroundTypePattern => { fill => 'BackgroundFill' },
backgrounds => { backgrounds => 'array:background' },
banChatMember => { member_id => 'MessageSender' },
bankCardInfo => { actions => 'array:bankCardActionOpenUrl' },
basicGroup => { status => 'ChatMemberStatus' },
basicGroupFullInfo => { bot_commands => 'array:botCommands', invite_link => 'chatInviteLink', members => 'array:chatMember', photo => 'chatPhoto' },
botCommands => { commands => 'array:botCommand' },
botInfo => { affiliate_program => 'affiliateProgramInfo', animation => 'animation', commands => 'array:botCommand', default_channel_administrator_rights => 'chatAdministratorRights', default_group_administra...
botMediaPreview => { content => 'StoryContent' },
botMediaPreviewInfo => { previews => 'array:botMediaPreview' },
botMediaPreviews => { previews => 'array:botMediaPreview' },
botVerification => { custom_description => 'formattedText' },
botVerificationParameters => { default_custom_description => 'formattedText' },
botWriteAccessAllowReasonLaunchedWebApp => { web_app => 'webApp' },
businessAwayMessageSettings => { recipients => 'businessRecipients', schedule => 'BusinessAwayMessageSchedule' },
businessChatLink => { text => 'formattedText' },
businessChatLinkInfo => { text => 'formattedText' },
businessChatLinks => { links => 'array:businessChatLink' },
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
inputStoryAreaTypeSuggestedReaction => { reaction_type => 'ReactionType' },
inputStoryAreas => { areas => 'array:inputStoryArea' },
inputStoryContentPhoto => { photo => 'InputFile' },
inputStoryContentVideo => { video => 'InputFile' },
inputSuggestedPostInfo => { price => 'SuggestedPostPrice' },
inputTextQuote => { text => 'formattedText' },
inputThumbnail => { thumbnail => 'InputFile' },
inputVideo => { cover => 'InputFile', thumbnail => 'inputThumbnail', video => 'InputFile' },
inputVideoNote => { thumbnail => 'inputThumbnail', video_note => 'InputFile' },
inputVoiceNote => { voice_note => 'InputFile' },
internalLinkTypeAttachmentMenuBot => { target_chat => 'TargetChat' },
internalLinkTypeBotAddToChannel => { administrator_rights => 'chatAdministratorRights' },
internalLinkTypeBotStartInGroup => { administrator_rights => 'chatAdministratorRights' },
internalLinkTypeMainWebApp => { mode => 'WebAppOpenMode' },
internalLinkTypeMessageDraft => { text => 'formattedText' },
internalLinkTypeNewStory => { content_type => 'StoryContentType' },
internalLinkTypeProxy => { proxy => 'proxy' },
internalLinkTypeSettings => { section => 'SettingsSection' },
internalLinkTypeWebApp => { mode => 'WebAppOpenMode' },
invoice => { price_parts => 'array:labeledPricePart' },
joinGroupCall => { input_group_call => 'InputGroupCall', join_parameters => 'groupCallJoinParameters' },
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
setEmojiStatus => { emoji_status => 'emojiStatus' },
setForumTopicNotificationSettings => { notification_settings => 'chatNotificationSettings' },
setGiftCollectionName => { owner_id => 'MessageSender' },
setGiftResalePrice => { price => 'GiftResalePrice' },
setGiftSettings => { settings => 'giftSettings' },
setGroupCallParticipantVolumeLevel => { participant_id => 'MessageSender' },
setLiveStoryMessageSender => { message_sender_id => 'MessageSender' },
setLogStream => { log_stream => 'LogStream' },
setMainProfileTab => { main_profile_tab => 'ProfileTab' },
setManagedBotAccessSettings => { settings => 'botAccessSettings' },
setMenuButton => { menu_button => 'botMenuButton' },
setMessageFactCheck => { text => 'formattedText' },
setMessageReactions => { reaction_types => 'array:ReactionType' },
setMessageSenderBlockList => { block_list => 'BlockList', sender_id => 'MessageSender' },
setMessageSenderBotVerification => { verified_id => 'MessageSender' },
setNetworkType => { type => 'NetworkType' },
setNewChatPrivacySettings => { settings => 'newChatPrivacySettings' },
setOption => { value => 'OptionValue' },
setPaidMessageReactionType => { type => 'PaidReactionType' },
setPassportElement => { element => 'InputPassportElement' },
setPassportElementErrors => { errors => 'array:inputPassportElementError' },
lib/EV/Telegram/TDLib/Schema.pm view on Meta::CPAN
translateText => { text => 'formattedText' },
trendingStickerSets => { sets => 'array:stickerSetInfo' },
unconfirmedSession => { type => 'SessionType' },
unreadReaction => { sender_id => 'MessageSender', type => 'ReactionType' },
updateAccentColors => { colors => 'array:accentColor' },
updateActiveGiftAuctions => { states => 'array:giftAuctionState' },
updateActiveLiveLocationMessages => { messages => 'array:message' },
updateActiveNotifications => { groups => 'array:notificationGroup' },
updateAgeVerificationParameters => { parameters => 'ageVerificationParameters' },
updateAnimatedEmojiMessageClicked => { sticker => 'sticker' },
updateAttachmentMenuBots => { bots => 'array:attachmentMenuBot' },
updateAuthorizationState => { authorization_state => 'AuthorizationState' },
updateAutosaveSettings => { scope => 'AutosaveSettingsScope', settings => 'scopeAutosaveSettings' },
updateBasicGroup => { basic_group => 'basicGroup' },
updateBasicGroupFullInfo => { basic_group_full_info => 'basicGroupFullInfo' },
updateBusinessConnection => { connection => 'businessConnection' },
updateBusinessMessageEdited => { message => 'businessMessage' },
updateCall => { call => 'call' },
updateChatAccentColors => { upgraded_gift_colors => 'upgradedGiftColors' },
updateChatAction => { action => 'ChatAction', sender_id => 'MessageSender', topic_id => 'MessageTopic' },
updateChatActionBar => { action_bar => 'ChatActionBar' },
t/25_bots_api.t view on Meta::CPAN
is $r->{result_id}, 'res1', 'result id passed through';
like last_json(), qr/"query_id":"918273"/, 'query id crosses as a JSON string';
$td->start_bot(42, 'ref9', sub {});
$r = last_req();
is $r->{'@type'}, 'sendBotStartMessage', 'start_bot sends sendBotStartMessage';
is $r->{parameter}, 'ref9', 'start parameter passed through';
is $r->{chat_id}, 42, 'the bot chat is the default target';
$td->attachment_menu_bot(42, sub {});
is last_req()->{'@type'}, 'getAttachmentMenuBot', 'attachment_menu_bot sends its method';
$td->toggle_attachment_menu(42, 1, sub {});
is last_req()->{'@type'}, 'toggleBotIsAddedToAttachmentMenu', 'toggle sends its method';
like last_json(), qr/"is_added":true/, 'is_added crosses as a JSON boolean';
$err = do { local $@; eval { $td->press(undef, 55, 'x', sub {}) }; $@ };
like $err, qr/required/, 'a missing chat id is refused';
done_testing;
t/35_practical_planes.t view on Meta::CPAN
$r = last_req();
is $r->{'@type'}, 'setUserPrivacySettingRules', 'set_privacy works';
is $r->{rules}{'@type'}, 'userPrivacySettingRules', 'rules are wrapped';
$err = do { local $@; eval { $td->privacy('mind', sub {}) }; $@ };
like $err, qr/unknown privacy setting/, 'an unknown privacy setting is refused';
# --- bots menu button
$td->set_menu_button(42, text => 'Shop', url => 'https://example.com', sub {});
$r = last_req();
is $r->{'@type'}, 'setMenuButton', 'set_menu_button works';
is $r->{menu_button}{'@type'}, 'botMenuButton', 'the button is typed';
is $r->{menu_button}{text}, 'Shop', 'with its text';
$td->menu_button(42, sub {});
is last_req()->{'@type'}, 'getMenuButton', 'menu_button works';
# --- connection, proxies, account
$td->add_proxy({ server => '1.2.3.4', port => 1080, type => 'socks5' }, sub {});
$r = last_req();
is $r->{'@type'}, 'addProxy', 'add_proxy works';
is $r->{proxy}{'@type'}, 'proxy', 'the proxy is typed';
is $r->{proxy}{type}{'@type'}, 'proxyTypeSocks5', 'and so is its type';
is $r->{proxy}{port}, 1080, 'with the port';
$td->add_proxy({ server => 'h', port => 8080, type => 'mtproto', secret => 'ss' }, sub {});