diff --git a/src/commands.rs b/src/commands.rs new file mode 100644 index 0000000..3bad887 --- /dev/null +++ b/src/commands.rs @@ -0,0 +1,33 @@ +/* +amFOSS Daemon: A discord bot for the amFOSS Discord server. +Copyright (C) 2024 amFOSS + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +use crate::Data; + +type Context<'a> = poise::Context<'a, Data, Error>; +type Error = Box; + +#[poise::command(prefix_command)] +async fn amdctl(ctx: Context<'_>) -> Result<(), Error> { + ctx.say("amD is up and running.").await?; + Ok(()) +} + +pub fn get_commands() -> Vec> { + vec![ + amdctl(), + ] +} diff --git a/src/main.rs b/src/main.rs index 311ea6c..e06d15e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,17 +15,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ +mod commands; + use anyhow::Context as _; struct Data {} -type Error = Box; -type Context<'a> = poise::Context<'a, Data, Error>; - -#[poise::command(prefix_command)] -async fn amdctl(ctx: Context<'_>) -> Result<(), Error> { - ctx.say("amD is up and running.").await?; - Ok(()) -} #[shuttle_runtime::main] async fn main( @@ -37,7 +31,7 @@ async fn main( let framework = poise::Framework::builder() .options(poise::FrameworkOptions { - commands: vec![amdctl()], + commands: commands::get_commands(), prefix_options: poise::PrefixFrameworkOptions { prefix: Option::Some(String::from("$")), ..Default::default()