-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsticker_packs.rs
38 lines (31 loc) · 1.02 KB
/
sticker_packs.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use tbot::{types::input_file::PngSticker, Bot};
const USER: i64 = 0;
// Must end with `_by_<bot_username>`
const NAME: &str = "tbot";
const TITLE: &str = "tbot";
const STICKERS: [(&[u8], &str); 2] = [
(include_bytes!("./assets/stickers/1.png"), "⌨️"),
(include_bytes!("./assets/stickers/2.png"), "🐱"),
];
#[tokio::main]
async fn main() -> Result<(), tbot::errors::MethodCall> {
let bot = Bot::from_env("BOT_TOKEN");
let user_id = USER.into();
let mut stickers = STICKERS.iter();
let &(bytes, emoji) = stickers.next().unwrap();
let sticker = PngSticker::with_bytes(bytes);
bot.create_new_sticker_set(user_id, NAME, TITLE, sticker, emoji)
.call()
.await?;
for &(bytes, emoji) in stickers {
let sticker = PngSticker::with_bytes(bytes);
bot.add_sticker_to_set(user_id, NAME, sticker, emoji)
.call()
.await?;
}
println!(
"Go check out this amazing sticker pack: https://t.me/addstickers/{}",
NAME,
);
Ok(())
}