Skip to content

Commit

Permalink
add version command, v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gamersi committed Sep 22, 2024
1 parent 88a5d03 commit 106b70d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mufbot-dc"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
license = "MIT"
authors = ["gamersi <[email protected]>"]
Expand Down
2 changes: 2 additions & 0 deletions src/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ pub async fn initiate_bot() {
commands::buildlist::buildlist(),
commands::shutdown::shutdown(),
commands::restart::restart(),
commands::version::version(),
],
..Default::default()
})
.setup(|ctx, _ready, framework| {

Box::pin(async move {

poise::builtins::register_globally(ctx, &framework.options().commands).await?;

let channel_id = serenity_prelude::ChannelId::new(crate::env::BOTS_CHANNEL_ID.parse().unwrap());
Expand Down
1 change: 1 addition & 0 deletions src/discord/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pub mod buildlist;
pub mod restart;
pub mod rollout;
pub mod shutdown;
pub mod version;

use poise::serenity_prelude::futures::lock::Mutex;
use std::sync::Arc;
Expand Down
32 changes: 32 additions & 0 deletions src/discord/commands/version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use poise::{
serenity_prelude, CreateReply,
};

#[poise::command(
slash_command,
prefix_command
)]

pub async fn version(
ctx: crate::discord::commands::Context<'_>,
) -> Result<
(),
crate::discord::commands::Error,
> {

let version =
env!("CARGO_PKG_VERSION");

let embed = serenity_prelude::CreateEmbed::default()
.title("Version")
.description(format!("Current version: {}", version))
.color(0x804fb3);

let message =
CreateReply::default()
.embed(embed);

ctx.send(message).await?;

Ok(())
}

0 comments on commit 106b70d

Please sign in to comment.