use crate::error::ApiError;
use crate::keyboard::InlineKeyboard;
use crate::screen::ReplyKeyboardAction;
use crate::types::*;
use async_trait::async_trait;
macro_rules! not_implemented {
($name:expr, $($arg:expr),* $(,)?) => {{
let _ = ($($arg,)*);
Err(ApiError::Unknown(concat!($name, " not implemented").into()))
}};
}
#[derive(Debug, Clone, Default)]
pub struct SendOptions {
pub protect_content: bool,
pub reply_keyboard: Option<ReplyKeyboardAction>,
pub reply_to: Option<MessageId>,
pub message_thread_id: Option<i32>,
}
#[async_trait]
pub trait BotApi: Send + Sync + 'static {
async fn send_message(
&self,
chat_id: ChatId,
content: MessageContent,
opts: SendOptions,
) -> Result<SentMessage, ApiError>;
async fn edit_message_text(
&self,
chat_id: ChatId,
message_id: MessageId,
text: String,
parse_mode: ParseMode,
keyboard: Option<InlineKeyboard>,
link_preview: bool,
) -> Result<(), ApiError>;
async fn edit_message_caption(
&self,
chat_id: ChatId,
message_id: MessageId,
caption: Option<String>,
parse_mode: ParseMode,
keyboard: Option<InlineKeyboard>,
) -> Result<(), ApiError>;
async fn edit_message_media(
&self,
chat_id: ChatId,
message_id: MessageId,
content: MessageContent,
keyboard: Option<InlineKeyboard>,
) -> Result<(), ApiError>;
async fn edit_message_keyboard(
&self,
chat_id: ChatId,
message_id: MessageId,
keyboard: Option<InlineKeyboard>,
) -> Result<(), ApiError>;
async fn delete_messages(
&self,
chat_id: ChatId,
message_ids: Vec<MessageId>,
) -> Result<(), ApiError>;
async fn answer_callback_query(
&self,
id: String,
text: Option<String>,
show_alert: bool,
) -> Result<(), ApiError>;
async fn send_chat_action(&self, chat_id: ChatId, action: ChatAction) -> Result<(), ApiError>;
async fn answer_inline_query(
&self,
query_id: String,
results: Vec<InlineQueryResult>,
next_offset: Option<String>,
cache_time: Option<i32>,
is_personal: bool,
) -> Result<(), ApiError>;
async fn forward_message(
&self,
chat_id: ChatId,
from_chat_id: ChatId,
message_id: MessageId,
) -> Result<SentMessage, ApiError> {
not_implemented!("forward_message", chat_id, from_chat_id, message_id)
}
async fn copy_message(
&self,
chat_id: ChatId,
from_chat_id: ChatId,
message_id: MessageId,
) -> Result<MessageId, ApiError> {
not_implemented!("copy_message", chat_id, from_chat_id, message_id)
}
async fn send_media_group(
&self,
chat_id: ChatId,
media: Vec<MediaGroupItem>,
) -> Result<Vec<SentMessage>, ApiError> {
not_implemented!("send_media_group", chat_id, media)
}
async fn download_file(&self, file_id: &str) -> Result<DownloadedFile, ApiError> {
not_implemented!("download_file", file_id)
}
async fn send_poll(&self, chat_id: ChatId, poll: SendPoll) -> Result<SentMessage, ApiError> {
not_implemented!("send_poll", chat_id, poll)
}
async fn stop_poll(&self, chat_id: ChatId, message_id: MessageId) -> Result<(), ApiError> {
not_implemented!("stop_poll", chat_id, message_id)
}
async fn send_dice(&self, chat_id: ChatId, emoji: DiceEmoji) -> Result<SentMessage, ApiError> {
not_implemented!("send_dice", chat_id, emoji)
}
async fn send_contact(
&self,
chat_id: ChatId,
contact: Contact,
) -> Result<SentMessage, ApiError> {
not_implemented!("send_contact", chat_id, contact)
}
async fn send_venue(&self, chat_id: ChatId, venue: Venue) -> Result<SentMessage, ApiError> {
not_implemented!("send_venue", chat_id, venue)
}
async fn send_invoice(
&self,
chat_id: ChatId,
invoice: Invoice,
) -> Result<SentMessage, ApiError> {
not_implemented!("send_invoice", chat_id, invoice)
}
async fn answer_pre_checkout_query(
&self,
id: String,
ok: bool,
error_message: Option<String>,
) -> Result<(), ApiError> {
not_implemented!("answer_pre_checkout_query", id, ok, error_message)
}
async fn ban_chat_member(&self, chat_id: ChatId, user_id: UserId) -> Result<(), ApiError> {
not_implemented!("ban_chat_member", chat_id, user_id)
}
async fn unban_chat_member(&self, chat_id: ChatId, user_id: UserId) -> Result<(), ApiError> {
not_implemented!("unban_chat_member", chat_id, user_id)
}
async fn restrict_chat_member(
&self,
chat_id: ChatId,
user_id: UserId,
permissions: ChatPermissions,
) -> Result<(), ApiError> {
not_implemented!("restrict_chat_member", chat_id, user_id, permissions)
}
async fn promote_chat_member(
&self,
chat_id: ChatId,
user_id: UserId,
permissions: ChatPermissions,
) -> Result<(), ApiError> {
not_implemented!("promote_chat_member", chat_id, user_id, permissions)
}
async fn get_chat_member(
&self,
chat_id: ChatId,
user_id: UserId,
) -> Result<ChatMember, ApiError> {
not_implemented!("get_chat_member", chat_id, user_id)
}
async fn get_chat_member_count(&self, chat_id: ChatId) -> Result<i32, ApiError> {
not_implemented!("get_chat_member_count", chat_id)
}
async fn get_chat(&self, chat_id: ChatId) -> Result<ChatInfo, ApiError> {
not_implemented!("get_chat", chat_id)
}
async fn leave_chat(&self, chat_id: ChatId) -> Result<(), ApiError> {
not_implemented!("leave_chat", chat_id)
}
async fn set_chat_permissions(
&self,
chat_id: ChatId,
permissions: ChatPermissions,
) -> Result<(), ApiError> {
not_implemented!("set_chat_permissions", chat_id, permissions)
}
async fn set_my_commands(&self, commands: Vec<BotCommand>) -> Result<(), ApiError> {
not_implemented!("set_my_commands", commands)
}
async fn delete_my_commands(&self) -> Result<(), ApiError> {
not_implemented!("delete_my_commands",)
}
async fn get_me(&self) -> Result<BotInfo, ApiError> {
not_implemented!("get_me",)
}
async fn set_message_reaction(
&self,
chat_id: ChatId,
message_id: MessageId,
emoji: &str,
) -> Result<(), ApiError> {
not_implemented!("set_message_reaction", chat_id, message_id, emoji)
}
async fn pin_chat_message(
&self,
chat_id: ChatId,
message_id: MessageId,
silent: bool,
) -> Result<(), ApiError> {
not_implemented!("pin_chat_message", chat_id, message_id, silent)
}
async fn unpin_chat_message(
&self,
chat_id: ChatId,
message_id: MessageId,
) -> Result<(), ApiError> {
not_implemented!("unpin_chat_message", chat_id, message_id)
}
async fn unpin_all_chat_messages(&self, chat_id: ChatId) -> Result<(), ApiError> {
not_implemented!("unpin_all_chat_messages", chat_id)
}
async fn create_chat_invite_link(
&self,
chat_id: ChatId,
name: Option<&str>,
expire_date: Option<i64>,
member_limit: Option<i32>,
) -> Result<String, ApiError> {
not_implemented!(
"create_chat_invite_link",
chat_id,
name,
expire_date,
member_limit
)
}
async fn export_chat_invite_link(&self, chat_id: ChatId) -> Result<String, ApiError> {
not_implemented!("export_chat_invite_link", chat_id)
}
async fn revoke_chat_invite_link(
&self,
chat_id: ChatId,
invite_link: &str,
) -> Result<ChatInviteLink, ApiError> {
not_implemented!("revoke_chat_invite_link", chat_id, invite_link)
}
async fn approve_chat_join_request(
&self,
chat_id: ChatId,
user_id: UserId,
) -> Result<(), ApiError> {
not_implemented!("approve_chat_join_request", chat_id, user_id)
}
async fn decline_chat_join_request(
&self,
chat_id: ChatId,
user_id: UserId,
) -> Result<(), ApiError> {
not_implemented!("decline_chat_join_request", chat_id, user_id)
}
async fn set_chat_title(&self, chat_id: ChatId, title: &str) -> Result<(), ApiError> {
not_implemented!("set_chat_title", chat_id, title)
}
async fn set_chat_description(
&self,
chat_id: ChatId,
description: Option<&str>,
) -> Result<(), ApiError> {
not_implemented!("set_chat_description", chat_id, description)
}
async fn set_chat_photo(&self, chat_id: ChatId, photo: FileSource) -> Result<(), ApiError> {
not_implemented!("set_chat_photo", chat_id, photo)
}
async fn delete_chat_photo(&self, chat_id: ChatId) -> Result<(), ApiError> {
not_implemented!("delete_chat_photo", chat_id)
}
async fn get_chat_administrators(&self, chat_id: ChatId) -> Result<Vec<ChatMember>, ApiError> {
not_implemented!("get_chat_administrators", chat_id)
}
async fn set_chat_administrator_custom_title(
&self,
chat_id: ChatId,
user_id: UserId,
custom_title: &str,
) -> Result<(), ApiError> {
not_implemented!(
"set_chat_administrator_custom_title",
chat_id,
user_id,
custom_title
)
}
async fn get_user_profile_photos(
&self,
user_id: UserId,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<UserProfilePhotos, ApiError> {
not_implemented!("get_user_profile_photos", user_id, offset, limit)
}
async fn get_my_commands(&self) -> Result<Vec<BotCommand>, ApiError> {
not_implemented!("get_my_commands",)
}
async fn set_my_description(
&self,
description: Option<&str>,
language_code: Option<&str>,
) -> Result<(), ApiError> {
not_implemented!("set_my_description", description, language_code)
}
async fn get_my_description(
&self,
language_code: Option<&str>,
) -> Result<BotDescription, ApiError> {
not_implemented!("get_my_description", language_code)
}
async fn set_my_short_description(
&self,
short_description: Option<&str>,
language_code: Option<&str>,
) -> Result<(), ApiError> {
not_implemented!("set_my_short_description", short_description, language_code)
}
async fn get_my_short_description(
&self,
language_code: Option<&str>,
) -> Result<BotShortDescription, ApiError> {
not_implemented!("get_my_short_description", language_code)
}
async fn set_my_name(
&self,
name: Option<&str>,
language_code: Option<&str>,
) -> Result<(), ApiError> {
not_implemented!("set_my_name", name, language_code)
}
async fn get_my_name(&self, language_code: Option<&str>) -> Result<BotName, ApiError> {
not_implemented!("get_my_name", language_code)
}
async fn set_chat_menu_button(
&self,
chat_id: Option<ChatId>,
menu_button: MenuButton,
) -> Result<(), ApiError> {
not_implemented!("set_chat_menu_button", chat_id, menu_button)
}
async fn get_chat_menu_button(&self, chat_id: Option<ChatId>) -> Result<MenuButton, ApiError> {
not_implemented!("get_chat_menu_button", chat_id)
}
async fn answer_shipping_query(
&self,
shipping_query_id: String,
ok: bool,
shipping_options: Option<Vec<ShippingOption>>,
error_message: Option<String>,
) -> Result<(), ApiError> {
not_implemented!(
"answer_shipping_query",
shipping_query_id,
ok,
shipping_options,
error_message
)
}
async fn create_invoice_link(&self, invoice: Invoice) -> Result<String, ApiError> {
not_implemented!("create_invoice_link", invoice)
}
async fn forward_messages(
&self,
chat_id: ChatId,
from_chat_id: ChatId,
message_ids: Vec<MessageId>,
) -> Result<Vec<MessageId>, ApiError> {
not_implemented!("forward_messages", chat_id, from_chat_id, message_ids)
}
async fn copy_messages(
&self,
chat_id: ChatId,
from_chat_id: ChatId,
message_ids: Vec<MessageId>,
) -> Result<Vec<MessageId>, ApiError> {
not_implemented!("copy_messages", chat_id, from_chat_id, message_ids)
}
async fn send_sticker(
&self,
chat_id: ChatId,
sticker: FileSource,
) -> Result<SentMessage, ApiError> {
not_implemented!("send_sticker", chat_id, sticker)
}
async fn send_location(
&self,
chat_id: ChatId,
latitude: f64,
longitude: f64,
) -> Result<SentMessage, ApiError> {
not_implemented!("send_location", chat_id, latitude, longitude)
}
async fn create_forum_topic(
&self,
chat_id: ChatId,
title: &str,
icon_color: Option<i32>,
icon_custom_emoji_id: Option<i64>,
) -> Result<ForumTopic, ApiError> {
not_implemented!(
"create_forum_topic",
chat_id,
title,
icon_color,
icon_custom_emoji_id
)
}
async fn edit_forum_topic(
&self,
chat_id: ChatId,
topic_id: i32,
title: Option<&str>,
icon_custom_emoji_id: Option<i64>,
closed: Option<bool>,
hidden: Option<bool>,
) -> Result<(), ApiError> {
not_implemented!(
"edit_forum_topic",
chat_id,
topic_id,
title,
icon_custom_emoji_id,
closed,
hidden
)
}
async fn close_forum_topic(&self, chat_id: ChatId, topic_id: i32) -> Result<(), ApiError> {
self.edit_forum_topic(chat_id, topic_id, None, None, Some(true), None)
.await
}
async fn reopen_forum_topic(&self, chat_id: ChatId, topic_id: i32) -> Result<(), ApiError> {
self.edit_forum_topic(chat_id, topic_id, None, None, Some(false), None)
.await
}
async fn delete_forum_topic(&self, chat_id: ChatId, topic_id: i32) -> Result<(), ApiError> {
not_implemented!("delete_forum_topic", chat_id, topic_id)
}
async fn unpin_all_forum_topic_messages(
&self,
chat_id: ChatId,
topic_id: i32,
) -> Result<(), ApiError> {
not_implemented!("unpin_all_forum_topic_messages", chat_id, topic_id)
}
async fn hide_general_forum_topic(&self, chat_id: ChatId) -> Result<(), ApiError> {
self.edit_forum_topic(chat_id, 1, None, None, None, Some(true))
.await
}
async fn unhide_general_forum_topic(&self, chat_id: ChatId) -> Result<(), ApiError> {
self.edit_forum_topic(chat_id, 1, None, None, None, Some(false))
.await
}
async fn get_star_transactions(
&self,
offset: Option<&str>,
limit: Option<i32>,
) -> Result<StarTransactions, ApiError> {
not_implemented!("get_star_transactions", offset, limit)
}
async fn refund_star_payment(&self, user_id: UserId, charge_id: &str) -> Result<(), ApiError> {
not_implemented!("refund_star_payment", user_id, charge_id)
}
async fn log_out(&self) -> Result<(), ApiError> {
not_implemented!("log_out",)
}
async fn close(&self) -> Result<(), ApiError> {
not_implemented!("close",)
}
async fn send_photo(
&self,
chat_id: ChatId,
photo: FileSource,
caption: Option<String>,
parse_mode: ParseMode,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
self.send_message(
chat_id,
MessageContent::Photo {
source: photo,
caption,
parse_mode,
keyboard: None,
spoiler: false,
},
opts,
)
.await
}
async fn send_audio(
&self,
chat_id: ChatId,
audio: FileSource,
caption: Option<String>,
parse_mode: ParseMode,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
self.send_message(
chat_id,
MessageContent::Document {
source: audio,
caption,
parse_mode,
keyboard: None,
filename: None,
},
opts,
)
.await
}
async fn send_document(
&self,
chat_id: ChatId,
document: FileSource,
caption: Option<String>,
parse_mode: ParseMode,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
self.send_message(
chat_id,
MessageContent::Document {
source: document,
caption,
parse_mode,
keyboard: None,
filename: None,
},
opts,
)
.await
}
async fn send_video(
&self,
chat_id: ChatId,
video: FileSource,
caption: Option<String>,
parse_mode: ParseMode,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
self.send_message(
chat_id,
MessageContent::Video {
source: video,
caption,
parse_mode,
keyboard: None,
spoiler: false,
},
opts,
)
.await
}
async fn send_animation(
&self,
chat_id: ChatId,
animation: FileSource,
caption: Option<String>,
parse_mode: ParseMode,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
self.send_message(
chat_id,
MessageContent::Animation {
source: animation,
caption,
parse_mode,
keyboard: None,
spoiler: false,
},
opts,
)
.await
}
async fn send_voice(
&self,
chat_id: ChatId,
voice: FileSource,
caption: Option<String>,
parse_mode: ParseMode,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
self.send_message(
chat_id,
MessageContent::Document {
source: voice,
caption,
parse_mode,
keyboard: None,
filename: None,
},
opts,
)
.await
}
async fn send_video_note(
&self,
chat_id: ChatId,
video_note: FileSource,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
self.send_message(
chat_id,
MessageContent::Document {
source: video_note,
caption: None,
parse_mode: ParseMode::None,
keyboard: None,
filename: None,
},
opts,
)
.await
}
async fn send_paid_media(
&self,
chat_id: ChatId,
star_count: i64,
media: Vec<PaidMediaInput>,
caption: Option<String>,
parse_mode: ParseMode,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
not_implemented!(
"send_paid_media",
chat_id,
star_count,
media,
caption,
parse_mode,
opts
)
}
async fn send_live_location(
&self,
chat_id: ChatId,
latitude: f64,
longitude: f64,
live_period: i32,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
not_implemented!(
"send_live_location",
chat_id,
latitude,
longitude,
live_period,
opts
)
}
async fn edit_message_live_location(
&self,
chat_id: ChatId,
message_id: MessageId,
latitude: f64,
longitude: f64,
) -> Result<(), ApiError> {
not_implemented!(
"edit_message_live_location",
chat_id,
message_id,
latitude,
longitude
)
}
async fn stop_message_live_location(
&self,
chat_id: ChatId,
message_id: MessageId,
) -> Result<(), ApiError> {
not_implemented!("stop_message_live_location", chat_id, message_id)
}
async fn send_checklist(
&self,
chat_id: ChatId,
title: String,
items: Vec<ChecklistItem>,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
not_implemented!("send_checklist", chat_id, title, items, opts)
}
async fn edit_message_checklist(
&self,
chat_id: ChatId,
message_id: MessageId,
title: String,
items: Vec<ChecklistItem>,
) -> Result<(), ApiError> {
not_implemented!("edit_message_checklist", chat_id, message_id, title, items)
}
async fn send_message_draft(
&self,
chat_id: ChatId,
text: String,
parse_mode: ParseMode,
) -> Result<(), ApiError> {
not_implemented!("send_message_draft", chat_id, text, parse_mode)
}
async fn set_user_emoji_status(
&self,
user_id: UserId,
emoji_status_custom_emoji_id: Option<String>,
emoji_status_expiration_date: Option<i64>,
) -> Result<(), ApiError> {
not_implemented!(
"set_user_emoji_status",
user_id,
emoji_status_custom_emoji_id,
emoji_status_expiration_date
)
}
async fn get_user_profile_audios(
&self,
user_id: UserId,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<UserProfileAudios, ApiError> {
not_implemented!("get_user_profile_audios", user_id, offset, limit)
}
async fn ban_chat_sender_chat(
&self,
chat_id: ChatId,
sender_chat_id: ChatId,
) -> Result<(), ApiError> {
not_implemented!("ban_chat_sender_chat", chat_id, sender_chat_id)
}
async fn unban_chat_sender_chat(
&self,
chat_id: ChatId,
sender_chat_id: ChatId,
) -> Result<(), ApiError> {
not_implemented!("unban_chat_sender_chat", chat_id, sender_chat_id)
}
async fn set_chat_member_tag(
&self,
chat_id: ChatId,
user_id: UserId,
tag: Option<String>,
) -> Result<(), ApiError> {
not_implemented!("set_chat_member_tag", chat_id, user_id, tag)
}
async fn edit_chat_invite_link(
&self,
chat_id: ChatId,
invite_link: &str,
name: Option<&str>,
expire_date: Option<i64>,
member_limit: Option<i32>,
) -> Result<ChatInviteLink, ApiError> {
not_implemented!(
"edit_chat_invite_link",
chat_id,
invite_link,
name,
expire_date,
member_limit
)
}
async fn create_chat_subscription_invite_link(
&self,
chat_id: ChatId,
name: Option<&str>,
subscription_period: i32,
subscription_price: i64,
) -> Result<ChatInviteLink, ApiError> {
not_implemented!(
"create_chat_subscription_invite_link",
chat_id,
name,
subscription_period,
subscription_price
)
}
async fn edit_chat_subscription_invite_link(
&self,
chat_id: ChatId,
invite_link: &str,
name: Option<&str>,
) -> Result<ChatInviteLink, ApiError> {
not_implemented!(
"edit_chat_subscription_invite_link",
chat_id,
invite_link,
name
)
}
async fn get_user_chat_boosts(
&self,
chat_id: ChatId,
user_id: UserId,
) -> Result<UserChatBoosts, ApiError> {
not_implemented!("get_user_chat_boosts", chat_id, user_id)
}
async fn set_my_default_administrator_rights(
&self,
rights: Option<ChatPermissions>,
for_channels: Option<bool>,
) -> Result<(), ApiError> {
not_implemented!("set_my_default_administrator_rights", rights, for_channels)
}
async fn get_my_default_administrator_rights(
&self,
for_channels: Option<bool>,
) -> Result<ChatPermissions, ApiError> {
not_implemented!("get_my_default_administrator_rights", for_channels)
}
async fn set_my_profile_photo(
&self,
photo: FileSource,
is_public: Option<bool>,
) -> Result<(), ApiError> {
not_implemented!("set_my_profile_photo", photo, is_public)
}
async fn remove_my_profile_photo(&self, file_id: Option<String>) -> Result<(), ApiError> {
not_implemented!("remove_my_profile_photo", file_id)
}
async fn edit_general_forum_topic(&self, chat_id: ChatId, title: &str) -> Result<(), ApiError> {
self.edit_forum_topic(chat_id, 1, Some(title), None, None, None)
.await
}
async fn close_general_forum_topic(&self, chat_id: ChatId) -> Result<(), ApiError> {
self.edit_forum_topic(chat_id, 1, None, None, Some(true), None)
.await
}
async fn reopen_general_forum_topic(&self, chat_id: ChatId) -> Result<(), ApiError> {
self.edit_forum_topic(chat_id, 1, None, None, Some(false), None)
.await
}
async fn unpin_all_general_forum_topic_messages(
&self,
chat_id: ChatId,
) -> Result<(), ApiError> {
self.unpin_all_forum_topic_messages(chat_id, 1).await
}
async fn verify_user(
&self,
user_id: UserId,
custom_description: Option<String>,
) -> Result<(), ApiError> {
not_implemented!("verify_user", user_id, custom_description)
}
async fn verify_chat(
&self,
chat_id: ChatId,
custom_description: Option<String>,
) -> Result<(), ApiError> {
not_implemented!("verify_chat", chat_id, custom_description)
}
async fn remove_user_verification(&self, user_id: UserId) -> Result<(), ApiError> {
not_implemented!("remove_user_verification", user_id)
}
async fn remove_chat_verification(&self, chat_id: ChatId) -> Result<(), ApiError> {
not_implemented!("remove_chat_verification", chat_id)
}
async fn get_business_connection(
&self,
business_connection_id: &str,
) -> Result<BusinessConnection, ApiError> {
not_implemented!("get_business_connection", business_connection_id)
}
async fn read_business_message(
&self,
business_connection_id: &str,
chat_id: ChatId,
message_id: MessageId,
) -> Result<(), ApiError> {
not_implemented!(
"read_business_message",
business_connection_id,
chat_id,
message_id
)
}
async fn delete_business_messages(
&self,
business_connection_id: &str,
message_ids: Vec<MessageId>,
) -> Result<(), ApiError> {
not_implemented!(
"delete_business_messages",
business_connection_id,
message_ids
)
}
async fn set_business_account_name(
&self,
business_connection_id: &str,
first_name: &str,
last_name: Option<&str>,
) -> Result<(), ApiError> {
not_implemented!(
"set_business_account_name",
business_connection_id,
first_name,
last_name
)
}
async fn set_business_account_username(
&self,
business_connection_id: &str,
username: Option<&str>,
) -> Result<(), ApiError> {
not_implemented!(
"set_business_account_username",
business_connection_id,
username
)
}
async fn set_business_account_bio(
&self,
business_connection_id: &str,
bio: Option<&str>,
) -> Result<(), ApiError> {
not_implemented!("set_business_account_bio", business_connection_id, bio)
}
async fn set_business_account_profile_photo(
&self,
business_connection_id: &str,
photo: FileSource,
is_public: Option<bool>,
) -> Result<(), ApiError> {
not_implemented!(
"set_business_account_profile_photo",
business_connection_id,
photo,
is_public
)
}
async fn remove_business_account_profile_photo(
&self,
business_connection_id: &str,
is_public: Option<bool>,
) -> Result<(), ApiError> {
not_implemented!(
"remove_business_account_profile_photo",
business_connection_id,
is_public
)
}
async fn set_business_account_gift_settings(
&self,
business_connection_id: &str,
show_gift_button: bool,
accepted_gift_types: AcceptedGiftTypes,
) -> Result<(), ApiError> {
not_implemented!(
"set_business_account_gift_settings",
business_connection_id,
show_gift_button,
accepted_gift_types
)
}
async fn get_business_account_star_balance(
&self,
business_connection_id: &str,
) -> Result<StarBalance, ApiError> {
not_implemented!("get_business_account_star_balance", business_connection_id)
}
async fn transfer_business_account_stars(
&self,
business_connection_id: &str,
star_count: i64,
) -> Result<(), ApiError> {
not_implemented!(
"transfer_business_account_stars",
business_connection_id,
star_count
)
}
async fn get_business_account_gifts(
&self,
business_connection_id: &str,
exclude_unsaved: Option<bool>,
exclude_saved: Option<bool>,
exclude_unlimited: Option<bool>,
exclude_limited: Option<bool>,
exclude_unique: Option<bool>,
sort_by_price: Option<bool>,
offset: Option<&str>,
limit: Option<i32>,
) -> Result<OwnedGifts, ApiError> {
not_implemented!(
"get_business_account_gifts",
business_connection_id,
exclude_unsaved,
exclude_saved,
exclude_unlimited,
exclude_limited,
exclude_unique,
sort_by_price,
offset,
limit
)
}
async fn get_available_gifts(&self) -> Result<Vec<Gift>, ApiError> {
not_implemented!("get_available_gifts",)
}
async fn send_gift(
&self,
user_id: UserId,
gift_id: String,
text: Option<String>,
text_parse_mode: Option<ParseMode>,
) -> Result<(), ApiError> {
not_implemented!("send_gift", user_id, gift_id, text, text_parse_mode)
}
async fn gift_premium_subscription(
&self,
user_id: UserId,
month_count: i32,
star_count: i64,
text: Option<String>,
text_parse_mode: Option<ParseMode>,
) -> Result<(), ApiError> {
not_implemented!(
"gift_premium_subscription",
user_id,
month_count,
star_count,
text,
text_parse_mode
)
}
async fn get_user_gifts(
&self,
user_id: UserId,
offset: Option<&str>,
limit: Option<i32>,
) -> Result<OwnedGifts, ApiError> {
not_implemented!("get_user_gifts", user_id, offset, limit)
}
async fn get_chat_gifts(
&self,
chat_id: ChatId,
offset: Option<&str>,
limit: Option<i32>,
) -> Result<OwnedGifts, ApiError> {
not_implemented!("get_chat_gifts", chat_id, offset, limit)
}
async fn convert_gift_to_stars(
&self,
business_connection_id: Option<&str>,
owned_gift_id: &str,
) -> Result<(), ApiError> {
not_implemented!(
"convert_gift_to_stars",
business_connection_id,
owned_gift_id
)
}
async fn upgrade_gift(
&self,
business_connection_id: Option<&str>,
owned_gift_id: &str,
keep_original_details: Option<bool>,
star_count: Option<i64>,
) -> Result<(), ApiError> {
not_implemented!(
"upgrade_gift",
business_connection_id,
owned_gift_id,
keep_original_details,
star_count
)
}
async fn transfer_gift(
&self,
business_connection_id: Option<&str>,
owned_gift_id: &str,
new_owner_chat_id: ChatId,
star_count: Option<i64>,
) -> Result<(), ApiError> {
not_implemented!(
"transfer_gift",
business_connection_id,
owned_gift_id,
new_owner_chat_id,
star_count
)
}
async fn post_story(
&self,
chat_id: ChatId,
content: StoryContent,
active_period: i32,
caption: Option<String>,
parse_mode: Option<ParseMode>,
) -> Result<Story, ApiError> {
not_implemented!(
"post_story",
chat_id,
content,
active_period,
caption,
parse_mode
)
}
async fn edit_story(
&self,
chat_id: ChatId,
story_id: i32,
content: Option<StoryContent>,
caption: Option<String>,
parse_mode: Option<ParseMode>,
) -> Result<Story, ApiError> {
not_implemented!(
"edit_story",
chat_id,
story_id,
content,
caption,
parse_mode
)
}
async fn delete_story(&self, chat_id: ChatId, story_id: i32) -> Result<(), ApiError> {
not_implemented!("delete_story", chat_id, story_id)
}
async fn get_my_star_balance(&self) -> Result<StarBalance, ApiError> {
not_implemented!("get_my_star_balance",)
}
async fn edit_user_star_subscription(
&self,
user_id: UserId,
telegram_payment_charge_id: &str,
is_canceled: bool,
) -> Result<(), ApiError> {
not_implemented!(
"edit_user_star_subscription",
user_id,
telegram_payment_charge_id,
is_canceled
)
}
async fn get_managed_bot_token(&self, bot_id: UserId) -> Result<String, ApiError> {
not_implemented!("get_managed_bot_token", bot_id)
}
async fn replace_managed_bot_token(&self, bot_id: UserId) -> Result<String, ApiError> {
not_implemented!("replace_managed_bot_token", bot_id)
}
async fn save_prepared_keyboard_button(
&self,
user_id: UserId,
button: PreparedKeyboardButtonData,
) -> Result<PreparedKeyboardButton, ApiError> {
not_implemented!("save_prepared_keyboard_button", user_id, button)
}
async fn get_sticker_set(&self, name: &str) -> Result<StickerSet, ApiError> {
not_implemented!("get_sticker_set", name)
}
async fn get_custom_emoji_stickers(
&self,
custom_emoji_ids: Vec<String>,
) -> Result<Vec<StickerInfo>, ApiError> {
not_implemented!("get_custom_emoji_stickers", custom_emoji_ids)
}
async fn upload_sticker_file(
&self,
user_id: UserId,
sticker: FileSource,
sticker_format: StickerFormat,
) -> Result<TelegramFile, ApiError> {
not_implemented!("upload_sticker_file", user_id, sticker, sticker_format)
}
async fn create_new_sticker_set(
&self,
user_id: UserId,
name: String,
title: String,
stickers: Vec<InputSticker>,
sticker_type: Option<StickerType>,
) -> Result<(), ApiError> {
not_implemented!(
"create_new_sticker_set",
user_id,
name,
title,
stickers,
sticker_type
)
}
async fn add_sticker_to_set(
&self,
user_id: UserId,
name: &str,
sticker: InputSticker,
) -> Result<(), ApiError> {
not_implemented!("add_sticker_to_set", user_id, name, sticker)
}
async fn set_sticker_position_in_set(
&self,
sticker: &str,
position: i32,
) -> Result<(), ApiError> {
not_implemented!("set_sticker_position_in_set", sticker, position)
}
async fn delete_sticker_from_set(&self, sticker: &str) -> Result<(), ApiError> {
not_implemented!("delete_sticker_from_set", sticker)
}
async fn replace_sticker_in_set(
&self,
user_id: UserId,
name: &str,
old_sticker: &str,
sticker: InputSticker,
) -> Result<(), ApiError> {
not_implemented!(
"replace_sticker_in_set",
user_id,
name,
old_sticker,
sticker
)
}
async fn set_sticker_emoji_list(
&self,
sticker: &str,
emoji_list: Vec<String>,
) -> Result<(), ApiError> {
not_implemented!("set_sticker_emoji_list", sticker, emoji_list)
}
async fn set_sticker_keywords(
&self,
sticker: &str,
keywords: Vec<String>,
) -> Result<(), ApiError> {
not_implemented!("set_sticker_keywords", sticker, keywords)
}
async fn set_sticker_mask_position(
&self,
sticker: &str,
mask_position: Option<MaskPosition>,
) -> Result<(), ApiError> {
not_implemented!("set_sticker_mask_position", sticker, mask_position)
}
async fn set_sticker_set_title(&self, name: &str, title: &str) -> Result<(), ApiError> {
not_implemented!("set_sticker_set_title", name, title)
}
async fn set_sticker_set_thumbnail(
&self,
name: &str,
user_id: UserId,
thumbnail: Option<FileSource>,
format: StickerFormat,
) -> Result<(), ApiError> {
not_implemented!(
"set_sticker_set_thumbnail",
name,
user_id,
thumbnail,
format
)
}
async fn set_custom_emoji_sticker_set_thumbnail(
&self,
name: &str,
custom_emoji_id: Option<String>,
) -> Result<(), ApiError> {
not_implemented!(
"set_custom_emoji_sticker_set_thumbnail",
name,
custom_emoji_id
)
}
async fn delete_sticker_set(&self, name: &str) -> Result<(), ApiError> {
not_implemented!("delete_sticker_set", name)
}
async fn get_forum_topic_icon_stickers(&self) -> Result<Vec<StickerInfo>, ApiError> {
not_implemented!("get_forum_topic_icon_stickers",)
}
async fn set_chat_sticker_set(
&self,
chat_id: ChatId,
sticker_set_name: &str,
) -> Result<(), ApiError> {
not_implemented!("set_chat_sticker_set", chat_id, sticker_set_name)
}
async fn delete_chat_sticker_set(&self, chat_id: ChatId) -> Result<(), ApiError> {
not_implemented!("delete_chat_sticker_set", chat_id)
}
async fn send_game(
&self,
chat_id: ChatId,
game_short_name: &str,
opts: SendOptions,
) -> Result<SentMessage, ApiError> {
not_implemented!("send_game", chat_id, game_short_name, opts)
}
async fn set_game_score(
&self,
user_id: UserId,
score: i64,
chat_id: ChatId,
message_id: MessageId,
force: bool,
disable_edit_message: bool,
) -> Result<(), ApiError> {
not_implemented!(
"set_game_score",
user_id,
score,
chat_id,
message_id,
force,
disable_edit_message
)
}
async fn get_game_high_scores(
&self,
user_id: UserId,
chat_id: ChatId,
message_id: MessageId,
) -> Result<Vec<GameHighScore>, ApiError> {
not_implemented!("get_game_high_scores", user_id, chat_id, message_id)
}
async fn answer_web_app_query(
&self,
web_app_query_id: &str,
result: InlineQueryResult,
) -> Result<SentWebAppMessage, ApiError> {
not_implemented!("answer_web_app_query", web_app_query_id, result)
}
async fn save_prepared_inline_message(
&self,
user_id: UserId,
result: InlineQueryResult,
allow_user_chats: Option<bool>,
allow_bot_chats: Option<bool>,
allow_group_chats: Option<bool>,
allow_channel_chats: Option<bool>,
) -> Result<PreparedInlineMessage, ApiError> {
not_implemented!(
"save_prepared_inline_message",
user_id,
result,
allow_user_chats,
allow_bot_chats,
allow_group_chats,
allow_channel_chats
)
}
async fn approve_suggested_post(
&self,
chat_id: ChatId,
message_id: MessageId,
) -> Result<(), ApiError> {
not_implemented!("approve_suggested_post", chat_id, message_id)
}
async fn decline_suggested_post(
&self,
chat_id: ChatId,
message_id: MessageId,
) -> Result<(), ApiError> {
not_implemented!("decline_suggested_post", chat_id, message_id)
}
async fn set_passport_data_errors(
&self,
user_id: UserId,
errors: Vec<PassportElementError>,
) -> Result<(), ApiError> {
not_implemented!("set_passport_data_errors", user_id, errors)
}
}