From 5655fa7c4a99d881b43948da21384956101a875a Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 24 Jan 2023 15:26:11 +0100 Subject: [PATCH] Construct Commands --- src/bot/commands.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bot/commands.rs b/src/bot/commands.rs index d477a09..0e40509 100644 --- a/src/bot/commands.rs +++ b/src/bot/commands.rs @@ -58,6 +58,14 @@ pub struct Commands { } impl Commands { + pub fn new() -> Self { + Self { + global: HashMap::new(), + general: HashMap::new(), + specific: HashMap::new(), + } + } + /// Global commands always respond. They override any specific or general /// commands of the same name. /// @@ -209,6 +217,12 @@ impl Commands { } } +impl Default for Commands { + fn default() -> Self { + Self::new() + } +} + #[cfg(test)] mod test { use super::{parse_command, parse_specific};