Added more states
+ clippy + fmt
This commit is contained in:
+27
-2
@@ -1,16 +1,20 @@
|
||||
use crate::config::BotConfig;
|
||||
use crate::models::api_key::Apikey;
|
||||
use crate::models::lil_fren::{AliveState, LilFren};
|
||||
use crate::models::lil_fren::{
|
||||
draw_dancing, draw_frankenstein, draw_gone, draw_magic, draw_mining, draw_resonance_cascade,
|
||||
draw_sick, draw_sleep, draw_standing, draw_tax_fraud, AliveState, LilFren,
|
||||
};
|
||||
use crate::{command, group, GlobalData};
|
||||
use json::JsonValue;
|
||||
use serenity::client::Context;
|
||||
use serenity::framework::standard::{Args, CommandResult};
|
||||
use serenity::model::channel::{AttachmentType, Message};
|
||||
use serenity::model::misc::EmojiIdentifier;
|
||||
use serenity::model::prelude::UserId;
|
||||
use std::borrow::Cow;
|
||||
|
||||
#[group]
|
||||
#[commands(reload, dump_db, load_db, add_key, debug_buddy)]
|
||||
#[commands(reload, dump_db, load_db, add_key, debug_buddy, draw_buddy_states)]
|
||||
pub struct ADMIN;
|
||||
|
||||
pub fn is_admin(user_id: &UserId, cfg: &BotConfig) -> bool {
|
||||
@@ -161,3 +165,24 @@ async fn debug_buddy(ctx: &Context, msg: &Message, _args: Args) -> CommandResult
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[description("Check little buddy stats")]
|
||||
async fn draw_buddy_states(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||
let emoji = args.parse::<EmojiIdentifier>()?;
|
||||
|
||||
let emoji = msg.guild_id.unwrap().emoji(&ctx.http, emoji.id).await?;
|
||||
|
||||
msg.reply(&ctx.http, draw_standing(&emoji)).await?;
|
||||
msg.reply(&ctx.http, draw_dancing(&emoji)).await?;
|
||||
msg.reply(&ctx.http, draw_frankenstein(&emoji)).await?;
|
||||
msg.reply(&ctx.http, draw_sick(&emoji)).await?;
|
||||
msg.reply(&ctx.http, draw_magic(&emoji)).await?;
|
||||
msg.reply(&ctx.http, draw_resonance_cascade(&emoji)).await?;
|
||||
msg.reply(&ctx.http, draw_tax_fraud(&emoji)).await?;
|
||||
msg.reply(&ctx.http, draw_sleep(&emoji)).await?;
|
||||
msg.reply(&ctx.http, draw_mining(&emoji)).await?;
|
||||
msg.reply(&ctx.http, draw_gone()).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -72,6 +72,17 @@ async fn checkup(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||
LilFrenState::Sick => "Oh no! Buddy is sick!",
|
||||
LilFrenState::Dancing => "Buddy got some moves!",
|
||||
LilFrenState::Sleep => "Shhh, buddy is asleep",
|
||||
LilFrenState::Magic => "Wizard Buddy loves casting spells",
|
||||
LilFrenState::AttemptingToCircumventDeath => {
|
||||
"Buddy appears to be researching how to be come immortal"
|
||||
}
|
||||
LilFrenState::AttemptingToNotCauseAResonanceCascade => {
|
||||
"Lil buddy is trying to prevent a resonance cascade"
|
||||
}
|
||||
LilFrenState::Mining => "Lil buddy found some diamonds!",
|
||||
LilFrenState::PhasedIntoYourReality => {
|
||||
"Lil Buddy has phased into your reality, they will be back soon"
|
||||
}
|
||||
};
|
||||
|
||||
msg.reply(&ctx.http, state_msg).await?;
|
||||
@@ -159,11 +170,14 @@ async fn give_water(ctx: &Context, msg: &Message, _args: Args) -> CommandResult
|
||||
msg.reply(&ctx.http, "Lil buddy be drinking!").await?;
|
||||
global_data.db.insert(lil_fren)?;
|
||||
|
||||
msg.reply(
|
||||
&ctx.http,
|
||||
lil_fren::draw_feed(&lil_fren_emoji, ":cup_with_straw:"),
|
||||
)
|
||||
.await?;
|
||||
let drink = if thread_rng().gen_bool(0.20) {
|
||||
":beer:"
|
||||
} else {
|
||||
":cup_with_straw:"
|
||||
};
|
||||
|
||||
msg.reply(&ctx.http, lil_fren::draw_feed(&lil_fren_emoji, drink))
|
||||
.await?;
|
||||
} else {
|
||||
msg.reply(&ctx.http, "You may want to check on your buddy...")
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user