Skip to main content

WrapperSendDocument

Struct WrapperSendDocument 

Source
pub struct WrapperSendDocument { /* private fields */ }

Implementations§

Source§

impl WrapperSendDocument

Source

pub fn send<'a>( self, ) -> impl Future<Item = (RequestHandle, Message), Error = Error> + 'a

Examples found in repository?
examples/send_self.rs (line 16)
8fn main() {
9    // Create the bot
10    let mut bot = Bot::new(&env::var("TELEGRAM_BOT_KEY").unwrap()).update_interval(200);
11
12    let handle = bot.new_cmd("/send_self")
13        .and_then(|(bot, msg)| {
14            bot.document(msg.chat.id)
15                .file("examples/send_self.rs")
16                .send()
17        })
18        .for_each(|_| Ok(()));
19
20    // enter the main loop
21    bot.run_with(handle);
22}
More examples
Hide additional examples
examples/send_memory.rs (line 51)
8fn main() {
9    // Create the bot
10    let mut bot = Bot::new(&env::var("TELEGRAM_BOT_KEY").unwrap()).update_interval(200);
11
12    let text = r"
13Dearest creature in creation,
14Study English pronunciation.
15I will teach you in my verse
16Sounds like corpse, corps, horse, and worse.
17I will keep you, Suzy, busy,
18Make your head with heat grow dizzy.
19Tear in eye, your dress will tear.
20So shall I! Oh hear my prayer.
21
22Just compare heart, beard, and heard,
23Dies and diet, lord and word,
24Sword and sward, retain and Britain.
25(Mind the latter, how it's written.)
26Now I surely will not plague you
27With such words as plaque and ague.
28But be careful how you speak:
29Say break and steak, but bleak and streak;
30Cloven, oven, how and low,
31Script, receipt, show, poem, and toe.
32
33Hear me say, devoid of trickery,
34Daughter, laughter, and Terpsichore,
35Typhoid, measles, topsails, aisles,
36Exiles, similes, and reviles;
37Scholar, vicar, and cigar,
38Solar, mica, war and far;
39One, anemone, Balmoral,
40Kitchen, lichen, laundry, laurel;
41Gertrude, German, wind and mind,
42Scene, Melpomene, mankind.
43
44...";
45
46    let handle = bot.new_cmd("/send")
47        .and_then(move |(bot, msg)| {
48            bot.document(msg.chat.id)
49                .file(("poem.txt", text.as_bytes()))
50                .caption("The Chaos")
51                .send()
52        })
53        .for_each(|_| Ok(()));
54
55    // enter the main loop
56    bot.run_with(handle);
57}
Source

pub fn document<S>(self, val: S) -> Self
where S: Into<MediaFile>,

Source

pub fn caption<S>(self, val: S) -> Self
where S: Into<String>,

Examples found in repository?
examples/send_memory.rs (line 50)
8fn main() {
9    // Create the bot
10    let mut bot = Bot::new(&env::var("TELEGRAM_BOT_KEY").unwrap()).update_interval(200);
11
12    let text = r"
13Dearest creature in creation,
14Study English pronunciation.
15I will teach you in my verse
16Sounds like corpse, corps, horse, and worse.
17I will keep you, Suzy, busy,
18Make your head with heat grow dizzy.
19Tear in eye, your dress will tear.
20So shall I! Oh hear my prayer.
21
22Just compare heart, beard, and heard,
23Dies and diet, lord and word,
24Sword and sward, retain and Britain.
25(Mind the latter, how it's written.)
26Now I surely will not plague you
27With such words as plaque and ague.
28But be careful how you speak:
29Say break and steak, but bleak and streak;
30Cloven, oven, how and low,
31Script, receipt, show, poem, and toe.
32
33Hear me say, devoid of trickery,
34Daughter, laughter, and Terpsichore,
35Typhoid, measles, topsails, aisles,
36Exiles, similes, and reviles;
37Scholar, vicar, and cigar,
38Solar, mica, war and far;
39One, anemone, Balmoral,
40Kitchen, lichen, laundry, laurel;
41Gertrude, German, wind and mind,
42Scene, Melpomene, mankind.
43
44...";
45
46    let handle = bot.new_cmd("/send")
47        .and_then(move |(bot, msg)| {
48            bot.document(msg.chat.id)
49                .file(("poem.txt", text.as_bytes()))
50                .caption("The Chaos")
51                .send()
52        })
53        .for_each(|_| Ok(()));
54
55    // enter the main loop
56    bot.run_with(handle);
57}
Source

pub fn parse_mode<S>(self, val: S) -> Self
where S: Into<ParseMode>,

Source

pub fn disable_notification<S>(self, val: S) -> Self
where S: Into<bool>,

Source

pub fn reply_to_message_id<S>(self, val: S) -> Self
where S: Into<Integer>,

Source

pub fn reply_markup<S>(self, val: S) -> Self
where S: Into<ReplyMarkup>,

Source

pub fn file<S, E>(self, val: S) -> Self
where S: TryIntoFile<Error = E>,

Examples found in repository?
examples/send_self.rs (line 15)
8fn main() {
9    // Create the bot
10    let mut bot = Bot::new(&env::var("TELEGRAM_BOT_KEY").unwrap()).update_interval(200);
11
12    let handle = bot.new_cmd("/send_self")
13        .and_then(|(bot, msg)| {
14            bot.document(msg.chat.id)
15                .file("examples/send_self.rs")
16                .send()
17        })
18        .for_each(|_| Ok(()));
19
20    // enter the main loop
21    bot.run_with(handle);
22}
More examples
Hide additional examples
examples/send_memory.rs (line 49)
8fn main() {
9    // Create the bot
10    let mut bot = Bot::new(&env::var("TELEGRAM_BOT_KEY").unwrap()).update_interval(200);
11
12    let text = r"
13Dearest creature in creation,
14Study English pronunciation.
15I will teach you in my verse
16Sounds like corpse, corps, horse, and worse.
17I will keep you, Suzy, busy,
18Make your head with heat grow dizzy.
19Tear in eye, your dress will tear.
20So shall I! Oh hear my prayer.
21
22Just compare heart, beard, and heard,
23Dies and diet, lord and word,
24Sword and sward, retain and Britain.
25(Mind the latter, how it's written.)
26Now I surely will not plague you
27With such words as plaque and ague.
28But be careful how you speak:
29Say break and steak, but bleak and streak;
30Cloven, oven, how and low,
31Script, receipt, show, poem, and toe.
32
33Hear me say, devoid of trickery,
34Daughter, laughter, and Terpsichore,
35Typhoid, measles, topsails, aisles,
36Exiles, similes, and reviles;
37Scholar, vicar, and cigar,
38Solar, mica, war and far;
39One, anemone, Balmoral,
40Kitchen, lichen, laundry, laurel;
41Gertrude, German, wind and mind,
42Scene, Melpomene, mankind.
43
44...";
45
46    let handle = bot.new_cmd("/send")
47        .and_then(move |(bot, msg)| {
48            bot.document(msg.chat.id)
49                .file(("poem.txt", text.as_bytes()))
50                .caption("The Chaos")
51                .send()
52        })
53        .for_each(|_| Ok(()));
54
55    // enter the main loop
56    bot.run_with(handle);
57}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.