use crate::Client;
use crate::errors::Result;
use crate::methods::accepted;
use crate::raw::functions;
#[must_use = "a request does nothing until it is awaited"]
pub struct SetBotName<'a> {
client: &'a Client,
name: String,
language_code: String,
}
impl Client {
pub fn set_bot_name(&self, name: impl Into<String>) -> SetBotName<'_> {
SetBotName { client: self, name: name.into(), language_code: String::new() }
}
}
impl SetBotName<'_> {
pub fn language_code(mut self, language_code: impl Into<String>) -> Self {
self.language_code = language_code.into();
self
}
async fn send(self) -> Result<()> {
let request = functions::bots::SetBotInfo {
bot: None,
lang_code: self.language_code,
name: Some(self.name),
about: None,
description: None,
};
accepted(self.client.invoke(&request).await?)
}
}
into_future!(SetBotName, ());