summaryrefslogtreecommitdiff
path: root/src/commands.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands.rs')
-rw-r--r--src/commands.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/commands.rs b/src/commands.rs
new file mode 100644
index 0000000..11c59a9
--- /dev/null
+++ b/src/commands.rs
@@ -0,0 +1,20 @@
+use std::error::Error;
+use teloxide::prelude::{AutoSend, Bot, Message, UpdateWithCx};
+use teloxide::utils::command::BotCommand;
+
+#[derive(BotCommand)]
+#[command(rename = "lowercase", description = "These commands are supported:")]
+pub enum Command {
+ #[command(description = "display this text")]
+ Help,
+}
+
+pub async fn handler(
+ cx: UpdateWithCx<AutoSend<Bot>, Message>,
+ command: Command,
+) -> Result<(), Box<dyn Error + Send + Sync>> {
+ match command {
+ Command::Help => cx.answer(Command::descriptions()).await?,
+ };
+ Ok(())
+}