mirror of
https://github.com/Xevion/banner.git
synced 2026-01-31 08:23:35 -06:00
feat!: first pass re-implementation of banner, gcal command
This commit is contained in:
+16
-12
@@ -1,16 +1,20 @@
|
||||
use poise::serenity_prelude as serenity;
|
||||
pub struct Data {} // User data, which is stored and accessible in all command invocations
|
||||
use crate::app_state::AppState;
|
||||
|
||||
pub mod commands;
|
||||
|
||||
pub struct Data {
|
||||
pub app_state: AppState,
|
||||
} // User data, which is stored and accessible in all command invocations
|
||||
pub type Error = Box<dyn std::error::Error + Send + Sync>;
|
||||
pub type Context<'a> = poise::Context<'a, Data, Error>;
|
||||
|
||||
/// Displays your or another user's account creation date
|
||||
#[poise::command(slash_command, prefix_command)]
|
||||
pub async fn age(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Selected user"] user: Option<serenity::User>,
|
||||
) -> Result<(), Error> {
|
||||
let u = user.as_ref().unwrap_or_else(|| ctx.author());
|
||||
let response = format!("{}'s account was created at {}", u.name, u.created_at());
|
||||
ctx.say(response).await?;
|
||||
Ok(())
|
||||
/// Get all available commands
|
||||
pub fn get_commands() -> Vec<poise::Command<Data, Error>> {
|
||||
vec![
|
||||
commands::search(),
|
||||
commands::terms(),
|
||||
commands::time(),
|
||||
commands::ics(),
|
||||
commands::gcal(),
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user