Added new callback types
This commit is contained in:
parent
c682fd310b
commit
64a5435dc3
107
Cargo.lock
generated
107
Cargo.lock
generated
@ -93,9 +93,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.71"
|
||||
version = "1.0.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
|
||||
checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854"
|
||||
|
||||
[[package]]
|
||||
name = "aquamarine"
|
||||
@ -135,18 +135,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.71"
|
||||
version = "0.1.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf"
|
||||
checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -571,9 +571,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.8.1"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
@ -730,7 +730,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1076,9 +1076,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.8"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
@ -1263,9 +1263,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
|
||||
checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
@ -1379,10 +1379,12 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arrayvec",
|
||||
"base64",
|
||||
"cryptography",
|
||||
"dotenv",
|
||||
"entity",
|
||||
"futures",
|
||||
"hex",
|
||||
"itertools 0.11.0",
|
||||
"log",
|
||||
"migration",
|
||||
@ -1392,6 +1394,7 @@ dependencies = [
|
||||
"sea-orm",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"teloxide",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
@ -1411,9 +1414,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.13"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35"
|
||||
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
@ -1457,7 +1460,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1556,9 +1559,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.64"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da"
|
||||
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -1585,9 +1588,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.29"
|
||||
version = "1.0.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105"
|
||||
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@ -1910,15 +1913,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.13"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f"
|
||||
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.14"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9"
|
||||
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||
|
||||
[[package]]
|
||||
name = "salsa20"
|
||||
@ -1931,9 +1934,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "scrypt"
|
||||
@ -2109,35 +2112,35 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
|
||||
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.171"
|
||||
version = "1.0.175"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9"
|
||||
checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.171"
|
||||
version = "1.0.175"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682"
|
||||
checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.102"
|
||||
version = "1.0.103"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed"
|
||||
checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@ -2363,9 +2366,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "stringprep"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1"
|
||||
checksum = "db3737bde7edce97102e0e2b15365bf7a20bfdb5f60f4f9e8d7004258a51a8da"
|
||||
dependencies = [
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
@ -2396,9 +2399,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.25"
|
||||
version = "2.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2"
|
||||
checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2504,22 +2507,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.43"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42"
|
||||
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.43"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f"
|
||||
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2601,7 +2604,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2686,7 +2689,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2748,9 +2751,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.10"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73"
|
||||
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
@ -2803,9 +2806,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.4.0"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be"
|
||||
checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"serde",
|
||||
@ -2859,7 +2862,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@ -2893,7 +2896,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.25",
|
||||
"syn 2.0.27",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
15
Cargo.toml
15
Cargo.toml
@ -14,20 +14,31 @@ members = [".", "migration", "entity", "cryptography"]
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
arrayvec = "0.7"
|
||||
base64 = "0.21"
|
||||
cryptography = { version = "0.1", path = "cryptography" }
|
||||
dotenv = "0.15"
|
||||
entity = { version = "0.1", path = "entity" }
|
||||
futures = "0.3"
|
||||
hex = "0.4"
|
||||
itertools = "0.11"
|
||||
log = "0.4"
|
||||
migration = { version = "0.2", path = "migration" }
|
||||
parking_lot = "0.12"
|
||||
pretty_env_logger = "0.5"
|
||||
rustc-hash = "1"
|
||||
sea-orm = { version = "0.11", features = ["sqlx-mysql", "runtime-tokio-rustls"] }
|
||||
sea-orm = { version = "0.11", features = [
|
||||
"sqlx-mysql",
|
||||
"runtime-tokio-rustls",
|
||||
] }
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
teloxide = { version = "0.12", features = ["macros", "ctrlc_handler", "rustls", "throttle"], default-features = false }
|
||||
sha2 = "0.10"
|
||||
teloxide = { version = "0.12", features = [
|
||||
"macros",
|
||||
"ctrlc_handler",
|
||||
"rustls",
|
||||
"throttle",
|
||||
], default-features = false }
|
||||
thiserror = "1"
|
||||
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
|
||||
trim-in-place = "0.1"
|
||||
|
@ -12,7 +12,10 @@ pbkdf2 = "0.12.1"
|
||||
thiserror = "1.0.40"
|
||||
entity = { version = "0.1.0", path = "../entity" }
|
||||
chacha20poly1305 = { version = "0.10.1", features = ["std"] }
|
||||
rand = { version = "0.8.5", default-features = false, features = ["std_rng", "std"] }
|
||||
rand = { version = "0.8.5", default-features = false, features = [
|
||||
"std_rng",
|
||||
"std",
|
||||
] }
|
||||
sea-orm = "0.11.3"
|
||||
bitflags = "2.3.1"
|
||||
arrayvec = "0.7.2"
|
||||
|
@ -2,7 +2,7 @@ use crate::prelude::*;
|
||||
use teloxide::{dispatching::DpHandlerDescription, dptree::Handler};
|
||||
|
||||
/// Deletes the message from the callback
|
||||
async fn run(bot: Throttle<Bot>, q: CallbackQuery) -> crate::Result<()> {
|
||||
pub async fn delete_message(bot: Throttle<Bot>, q: CallbackQuery) -> crate::Result<()> {
|
||||
if let Some(msg) = q.message {
|
||||
if bot.delete_message(msg.chat.id, msg.id).await.is_err() {
|
||||
bot.send_message(msg.chat.id, "Error deleting the message")
|
||||
@ -13,14 +13,3 @@ async fn run(bot: Throttle<Bot>, q: CallbackQuery) -> crate::Result<()> {
|
||||
bot.answer_callback_query(q.id).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Filters the delete_message callbacks
|
||||
fn filter(q: CallbackQuery) -> bool {
|
||||
matches!(q.data.as_deref(), Some("delete_message"))
|
||||
}
|
||||
|
||||
/// Gets a handler for deleting the message
|
||||
#[inline]
|
||||
pub fn get_handler() -> Handler<'static, DependencyMap, crate::Result<()>, DpHandlerDescription> {
|
||||
dptree::filter(filter).endpoint(run)
|
||||
}
|
||||
|
@ -1,3 +1,76 @@
|
||||
//! This module consists of endpoints to handle callbacks
|
||||
|
||||
pub mod delete_message;
|
||||
mod delete_message;
|
||||
|
||||
pub use delete_message::delete_message;
|
||||
|
||||
use crate::errors::InvalidCommand;
|
||||
use base64::{engine::general_purpose::STANDARD_NO_PAD as B64_ENGINE, Engine as _};
|
||||
use std::str::FromStr;
|
||||
use teloxide::types::{CallbackQuery, Message};
|
||||
|
||||
type NameHash = [u8; 32];
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum AlterableField {
|
||||
Name,
|
||||
Login,
|
||||
Pass,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum CallbackCommand {
|
||||
DeleteMessage,
|
||||
Get(NameHash),
|
||||
GetMenu,
|
||||
GetAccounts,
|
||||
Decrypt(NameHash),
|
||||
Hide(NameHash),
|
||||
Alter(NameHash, AlterableField),
|
||||
DeleteAccount(NameHash),
|
||||
}
|
||||
|
||||
impl CallbackCommand {
|
||||
pub fn from_query(q: CallbackQuery) -> Option<Self> {
|
||||
q.message.as_ref()?;
|
||||
q.data.and_then(|text| text.parse().ok())
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for CallbackCommand {
|
||||
type Err = crate::errors::InvalidCommand;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
use AlterableField::*;
|
||||
use CallbackCommand::*;
|
||||
|
||||
match s {
|
||||
"delete_message" => return Ok(DeleteMessage),
|
||||
"get_menu" => return Ok(GetMenu),
|
||||
"get_accounts" => return Ok(GetAccounts),
|
||||
_ => (),
|
||||
};
|
||||
|
||||
let mut substrings = s.split(' ');
|
||||
let (command, name) = match (substrings.next(), substrings.next(), substrings.next()) {
|
||||
(Some(command), Some(name), None) => (command, name),
|
||||
_ => return Err(InvalidCommand::InvalidParams),
|
||||
};
|
||||
|
||||
let mut name_arr = [0; 32];
|
||||
if B64_ENGINE.decode_slice(name, &mut name_arr)? != 32 {
|
||||
return Err(InvalidCommand::OutputTooShort);
|
||||
};
|
||||
|
||||
match command {
|
||||
"get" => Ok(Get(name_arr)),
|
||||
"decrypt" => Ok(Decrypt(name_arr)),
|
||||
"hide" => Ok(Hide(name_arr)),
|
||||
"an" => Ok(Alter(name_arr, Name)),
|
||||
"al" => Ok(Alter(name_arr, Login)),
|
||||
"ap" => Ok(Alter(name_arr, Pass)),
|
||||
"delete" => Ok(DeleteAccount(name_arr)),
|
||||
_ => Err(InvalidCommand::InvalidParams),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,3 +5,13 @@ pub struct NoUserInfo;
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
#[error("Handler was already used")]
|
||||
pub struct HandlerUsed;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum InvalidCommand {
|
||||
#[error("Invalid params")]
|
||||
InvalidParams,
|
||||
#[error("Not enough bytes in the name's hash")]
|
||||
OutputTooShort,
|
||||
#[error("Error decoding the values: {0}")]
|
||||
NameDecodingError(#[from] base64::DecodeSliceError),
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(unused)]
|
||||
|
||||
mod callbacks;
|
||||
mod commands;
|
||||
mod default;
|
||||
@ -18,6 +20,8 @@ use sea_orm::Database;
|
||||
use std::env;
|
||||
use teloxide::{adaptors::throttle::Limits, dispatching::dialogue::InMemStorage, filter_command};
|
||||
|
||||
use crate::callbacks::CallbackCommand;
|
||||
|
||||
fn get_dispatcher(
|
||||
token: String,
|
||||
db: DatabaseConnection,
|
||||
@ -55,8 +59,9 @@ fn get_dispatcher(
|
||||
.branch(command_handler)
|
||||
.endpoint(default::default);
|
||||
|
||||
let callback_handler =
|
||||
Update::filter_callback_query().chain(callbacks::delete_message::get_handler());
|
||||
let callback_handler = Update::filter_callback_query()
|
||||
.filter_map(CallbackCommand::from_query)
|
||||
.branch(case![CallbackCommand::DeleteMessage].endpoint(callbacks::delete_message));
|
||||
|
||||
let handler = dptree::entry()
|
||||
.branch(message_handler)
|
||||
|
@ -1,4 +1,8 @@
|
||||
use crate::prelude::*;
|
||||
use base64::{engine::general_purpose::STANDARD as B64_ENGINE, Engine as _};
|
||||
use futures::future;
|
||||
use itertools::Itertools;
|
||||
use sha2::{Digest, Sha256};
|
||||
use teloxide::types::{InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, KeyboardMarkup};
|
||||
|
||||
/// Creates a markup of all user's account names
|
||||
|
Loading…
Reference in New Issue
Block a user