From 69474aafe6e8ccc2a0aa1e6ffa94ebc27cdf23c2 Mon Sep 17 00:00:00 2001 From: liyunze <50455574+liyunze-coding@users.noreply.github.com> Date: Wed, 12 Nov 2025 00:14:04 +1100 Subject: [PATCH] updated CI/CD pipeline and added bot info command --- .github/workflows/deploy.yml | 1 + src/commands/info.rs | 42 +++++++++++++++++++++++++++++++++++- src/main.rs | 1 + 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7aa7ac3..d640419 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,6 +17,7 @@ jobs: run: | echo "Starting Docker Compose with --build and --force-recreate..." cd ~/dsec_bot + sudo git pull sudo docker-compose down sudo docker-compose build sudo docker-compose up -d diff --git a/src/commands/info.rs b/src/commands/info.rs index 808763f..3317d40 100644 --- a/src/commands/info.rs +++ b/src/commands/info.rs @@ -1,6 +1,6 @@ use crate::{Context, Error}; use poise::CreateReply; -use serenity::all::{ChannelType, Colour, CreateEmbed, CreateEmbedFooter, GuildId, User}; +use serenity::all::{ChannelType, Colour, CreateEmbed, CreateEmbedFooter, GuildId, User, UserId}; use std::{collections::HashMap, time::Instant}; /// Show this help menu @@ -181,3 +181,43 @@ pub async fn serverinfo(ctx: Context<'_>) -> Result<(), Error> { Ok(()) } + +/// Display DSEC Bot's information +#[poise::command(slash_command)] +pub async fn botinfo(ctx: Context<'_>) -> Result<(), Error> { + let bot_id = UserId::new(1434887135135268935); + let discord_member = GuildId::member(ctx.guild_id().unwrap(), ctx, bot_id).await?; + let discord_user = discord_member.user; + + // color + let embed_color = discord_user.accent_colour.unwrap_or(Colour::DARK_GREY); + + // member dates + let member_created_at = discord_user.created_at().format("%d/%m/%Y %I:%M %p"); + + // user information + let user_id = &discord_user.id; + let user_avatar_url = discord_user + .avatar_url() + .unwrap_or(discord_user.default_avatar_url()); + + // embed + let result_embed_msg = CreateEmbed::new() + .thumbnail(user_avatar_url) + .color(embed_color) + .title("DSEC Bot Info") + .description("The DSEC Discord Bot is a project by **Deakin Software Engineering Club** to encourage students to learn Rust in a practical and interactive collaboration project") + .field("Tech Stack", "Rust (Poise framework)", true) + .field( + "Repository URL", + "[Github Repository](https://github.com/liyunze-coding/DSEC-Discord-Bot)", + true, + ) + .field("Created At", format!("{}", member_created_at), false) + .footer(CreateEmbedFooter::new(format!("ID: {}", user_id))); + + ctx.send(CreateReply::default().embed(result_embed_msg)) + .await?; + + Ok(()) +} diff --git a/src/main.rs b/src/main.rs index 0b3e141..2eebe07 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,7 @@ async fn main() { commands::info::ping(), commands::info::userinfo(), commands::info::serverinfo(), + commands::info::botinfo(), commands::weather::weather(), ], ..Default::default()