telegram_bot_oxidebot 0.1.3

Telegram Bot for oxidebot framework
Documentation
//! Telegram Bot API 10.2 method and update catalog.
//!
//! The native API call path is intentionally not restricted to this list, so
//! a newly released Telegram method remains callable before this catalog is
//! updated.

pub const TELEGRAM_BOT_API_METHODS: &[&str] = &[
    "addStickerToSet",
    "answerCallbackQuery",
    "answerChatJoinRequestQuery",
    "answerGuestQuery",
    "answerInlineQuery",
    "answerPreCheckoutQuery",
    "answerShippingQuery",
    "answerWebAppQuery",
    "approveChatJoinRequest",
    "approveSuggestedPost",
    "banChatMember",
    "banChatSenderChat",
    "close",
    "closeForumTopic",
    "closeGeneralForumTopic",
    "convertGiftToStars",
    "copyMessage",
    "copyMessages",
    "createChatInviteLink",
    "createChatSubscriptionInviteLink",
    "createForumTopic",
    "createInvoiceLink",
    "createNewStickerSet",
    "declineChatJoinRequest",
    "declineSuggestedPost",
    "deleteAllMessageReactions",
    "deleteBusinessMessages",
    "deleteChatPhoto",
    "deleteChatStickerSet",
    "deleteEphemeralMessage",
    "deleteForumTopic",
    "deleteMessage",
    "deleteMessageReaction",
    "deleteMessages",
    "deleteMyCommands",
    "deleteStickerFromSet",
    "deleteStickerSet",
    "deleteStory",
    "deleteWebhook",
    "editChatInviteLink",
    "editChatSubscriptionInviteLink",
    "editEphemeralMessageCaption",
    "editEphemeralMessageMedia",
    "editEphemeralMessageReplyMarkup",
    "editEphemeralMessageText",
    "editForumTopic",
    "editGeneralForumTopic",
    "editMessageCaption",
    "editMessageChecklist",
    "editMessageLiveLocation",
    "editMessageMedia",
    "editMessageReplyMarkup",
    "editMessageText",
    "editStory",
    "editUserStarSubscription",
    "exportChatInviteLink",
    "forwardMessage",
    "forwardMessages",
    "getAvailableGifts",
    "getBusinessAccountGifts",
    "getBusinessAccountStarBalance",
    "getBusinessConnection",
    "getChat",
    "getChatAdministrators",
    "getChatGifts",
    "getChatMember",
    "getChatMemberCount",
    "getChatMenuButton",
    "getCustomEmojiStickers",
    "getFile",
    "getForumTopicIconStickers",
    "getGameHighScores",
    "getManagedBotAccessSettings",
    "getManagedBotToken",
    "getMe",
    "getMyCommands",
    "getMyDefaultAdministratorRights",
    "getMyDescription",
    "getMyName",
    "getMyShortDescription",
    "getMyStarBalance",
    "getStarTransactions",
    "getStickerSet",
    "getUpdates",
    "getUserChatBoosts",
    "getUserGifts",
    "getUserPersonalChatMessages",
    "getUserProfileAudios",
    "getUserProfilePhotos",
    "getWebhookInfo",
    "giftPremiumSubscription",
    "hideGeneralForumTopic",
    "leaveChat",
    "logOut",
    "pinChatMessage",
    "postStory",
    "promoteChatMember",
    "readBusinessMessage",
    "refundStarPayment",
    "removeBusinessAccountProfilePhoto",
    "removeChatVerification",
    "removeMyProfilePhoto",
    "removeUserVerification",
    "reopenForumTopic",
    "reopenGeneralForumTopic",
    "replaceManagedBotToken",
    "replaceStickerInSet",
    "repostStory",
    "restrictChatMember",
    "revokeChatInviteLink",
    "savePreparedInlineMessage",
    "savePreparedKeyboardButton",
    "sendAnimation",
    "sendAudio",
    "sendChatAction",
    "sendChatJoinRequestWebApp",
    "sendChecklist",
    "sendContact",
    "sendDice",
    "sendDocument",
    "sendGame",
    "sendGift",
    "sendInvoice",
    "sendLivePhoto",
    "sendLocation",
    "sendMediaGroup",
    "sendMessage",
    "sendMessageDraft",
    "sendPaidMedia",
    "sendPhoto",
    "sendPoll",
    "sendRichMessage",
    "sendRichMessageDraft",
    "sendSticker",
    "sendVenue",
    "sendVideo",
    "sendVideoNote",
    "sendVoice",
    "setBusinessAccountBio",
    "setBusinessAccountGiftSettings",
    "setBusinessAccountName",
    "setBusinessAccountProfilePhoto",
    "setBusinessAccountUsername",
    "setChatAdministratorCustomTitle",
    "setChatDescription",
    "setChatMemberTag",
    "setChatMenuButton",
    "setChatPermissions",
    "setChatPhoto",
    "setChatStickerSet",
    "setChatTitle",
    "setCustomEmojiStickerSetThumbnail",
    "setGameScore",
    "setManagedBotAccessSettings",
    "setMessageReaction",
    "setMyCommands",
    "setMyDefaultAdministratorRights",
    "setMyDescription",
    "setMyName",
    "setMyProfilePhoto",
    "setMyShortDescription",
    "setPassportDataErrors",
    "setStickerEmojiList",
    "setStickerKeywords",
    "setStickerMaskPosition",
    "setStickerPositionInSet",
    "setStickerSetThumbnail",
    "setStickerSetTitle",
    "setUserEmojiStatus",
    "setWebhook",
    "stopMessageLiveLocation",
    "stopPoll",
    "transferBusinessAccountStars",
    "transferGift",
    "unbanChatMember",
    "unbanChatSenderChat",
    "unhideGeneralForumTopic",
    "unpinAllChatMessages",
    "unpinAllForumTopicMessages",
    "unpinAllGeneralForumTopicMessages",
    "unpinChatMessage",
    "upgradeGift",
    "uploadStickerFile",
    "verifyChat",
    "verifyUser",
];

pub const TELEGRAM_BOT_API_UPDATE_TYPES: &[&str] = &[
    "message",
    "edited_message",
    "channel_post",
    "edited_channel_post",
    "business_connection",
    "business_message",
    "edited_business_message",
    "deleted_business_messages",
    "guest_message",
    "message_reaction",
    "message_reaction_count",
    "inline_query",
    "chosen_inline_result",
    "callback_query",
    "shipping_query",
    "pre_checkout_query",
    "purchased_paid_media",
    "poll",
    "poll_answer",
    "my_chat_member",
    "chat_member",
    "chat_join_request",
    "chat_boost",
    "removed_chat_boost",
    "managed_bot",
    "subscription",
];

#[cfg(test)]
mod tests {
    use std::collections::HashSet;

    use super::*;

    #[test]
    fn bot_api_10_2_catalog_has_every_official_method_once() {
        assert_eq!(TELEGRAM_BOT_API_METHODS.len(), 185);
        assert_eq!(
            TELEGRAM_BOT_API_METHODS
                .iter()
                .copied()
                .collect::<HashSet<_>>()
                .len(),
            185
        );
        for method in [
            "sendRichMessage",
            "sendRichMessageDraft",
            "editEphemeralMessageText",
            "deleteEphemeralMessage",
            "answerGuestQuery",
        ] {
            assert!(TELEGRAM_BOT_API_METHODS.contains(&method));
        }
    }

    #[test]
    fn bot_api_10_2_catalog_has_every_update_type() {
        assert_eq!(TELEGRAM_BOT_API_UPDATE_TYPES.len(), 26);
        assert!(TELEGRAM_BOT_API_UPDATE_TYPES.contains(&"subscription"));
        assert!(TELEGRAM_BOT_API_UPDATE_TYPES.contains(&"managed_bot"));
        assert!(TELEGRAM_BOT_API_UPDATE_TYPES.contains(&"guest_message"));
    }
}