mirror of
https://github.com/dsec-hub/dsec-discord-bot.git
synced 2026-09-22 07:44:26 +00:00
updated CI/CD pipeline and added bot info command
This commit is contained in:
parent
a20d68855f
commit
69474aafe6
3 changed files with 43 additions and 1 deletions
1
.github/workflows/deploy.yml
vendored
1
.github/workflows/deploy.yml
vendored
|
|
@ -17,6 +17,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "Starting Docker Compose with --build and --force-recreate..."
|
echo "Starting Docker Compose with --build and --force-recreate..."
|
||||||
cd ~/dsec_bot
|
cd ~/dsec_bot
|
||||||
|
sudo git pull
|
||||||
sudo docker-compose down
|
sudo docker-compose down
|
||||||
sudo docker-compose build
|
sudo docker-compose build
|
||||||
sudo docker-compose up -d
|
sudo docker-compose up -d
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{Context, Error};
|
use crate::{Context, Error};
|
||||||
use poise::CreateReply;
|
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};
|
use std::{collections::HashMap, time::Instant};
|
||||||
|
|
||||||
/// Show this help menu
|
/// Show this help menu
|
||||||
|
|
@ -181,3 +181,43 @@ pub async fn serverinfo(ctx: Context<'_>) -> Result<(), Error> {
|
||||||
|
|
||||||
Ok(())
|
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(())
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ async fn main() {
|
||||||
commands::info::ping(),
|
commands::info::ping(),
|
||||||
commands::info::userinfo(),
|
commands::info::userinfo(),
|
||||||
commands::info::serverinfo(),
|
commands::info::serverinfo(),
|
||||||
|
commands::info::botinfo(),
|
||||||
commands::weather::weather(),
|
commands::weather::weather(),
|
||||||
],
|
],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue