more commands!
This commit is contained in:
parent
8c58768ac2
commit
29c2e07b57
@ -50,3 +50,38 @@ pub async fn penis(
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Magic 8-ball
|
||||||
|
#[poise::command(slash_command)]
|
||||||
|
pub async fn eightball(ctx: Context<'_>) -> Result<(), Error> {
|
||||||
|
let responses = [
|
||||||
|
"It is certain",
|
||||||
|
"It is decidedly so",
|
||||||
|
"Without a doubt",
|
||||||
|
"Yes definitely",
|
||||||
|
"You may rely on it",
|
||||||
|
"As I see it, yes",
|
||||||
|
"Most likely",
|
||||||
|
"Outlook good",
|
||||||
|
"Yes",
|
||||||
|
"Signs point to yes",
|
||||||
|
"Reply hazy, try again",
|
||||||
|
"Ask again later",
|
||||||
|
"Better not to tell you now",
|
||||||
|
"Cannot predict now",
|
||||||
|
"Concentrate and ask again",
|
||||||
|
"Don't count on it",
|
||||||
|
"My reply is no",
|
||||||
|
"My sources say no",
|
||||||
|
"Outlook not so good",
|
||||||
|
"Very doubtful",
|
||||||
|
];
|
||||||
|
let response = {
|
||||||
|
let mut rng = rand::thread_rng();
|
||||||
|
responses.choose(&mut rng).unwrap()
|
||||||
|
};
|
||||||
|
ctx.say(format!("Magic 8-ball says: '{}'", *response))
|
||||||
|
.await?;
|
||||||
|
info!("Executed command `eightball` successfully");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use poise::serenity_prelude as serenity;
|
use poise::serenity_prelude as serenity;
|
||||||
|
use rand::Rng;
|
||||||
|
|
||||||
use crate::Context;
|
use crate::Context;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
@ -43,7 +44,7 @@ pub async fn info(ctx: Context<'_>) -> Result<(), Error> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add information to the shared settings
|
/// Add channel to the registry
|
||||||
#[poise::command(slash_command)]
|
#[poise::command(slash_command)]
|
||||||
pub async fn add_channel(
|
pub async fn add_channel(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
@ -68,7 +69,7 @@ pub async fn add_channel(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove information from the shared settings
|
/// Remove channel from the registry
|
||||||
#[poise::command(slash_command)]
|
#[poise::command(slash_command)]
|
||||||
pub async fn remove_channel(
|
pub async fn remove_channel(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
@ -94,6 +95,7 @@ pub async fn remove_channel(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// List channels held in the registry
|
||||||
#[poise::command(slash_command)]
|
#[poise::command(slash_command)]
|
||||||
pub async fn list_channels(ctx: Context<'_>) -> Result<(), Error> {
|
pub async fn list_channels(ctx: Context<'_>) -> Result<(), Error> {
|
||||||
ctx.defer_ephemeral().await?;
|
ctx.defer_ephemeral().await?;
|
||||||
@ -111,3 +113,22 @@ pub async fn list_channels(ctx: Context<'_>) -> Result<(), Error> {
|
|||||||
info!("Executed command `list_channels` successfully");
|
info!("Executed command `list_channels` successfully");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generate a random number, supply 1 for coin toss
|
||||||
|
#[poise::command(slash_command)]
|
||||||
|
pub async fn dice(
|
||||||
|
ctx: Context<'_>,
|
||||||
|
#[description = "The upper limit of the random number"] bound: u32,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let answer: u32 = {
|
||||||
|
let mut rng = rand::thread_rng();
|
||||||
|
rng.gen_range(0..=bound)
|
||||||
|
};
|
||||||
|
ctx.say(format!(
|
||||||
|
"Rolled a random number from 0 to {}, got: {}",
|
||||||
|
bound, answer
|
||||||
|
))
|
||||||
|
.await?;
|
||||||
|
info!("Executed command `dice` successfully");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
@ -84,12 +84,14 @@ async fn main() {
|
|||||||
remove_channel(),
|
remove_channel(),
|
||||||
list_channels(),
|
list_channels(),
|
||||||
invite(),
|
invite(),
|
||||||
|
dice(),
|
||||||
// Dev
|
// Dev
|
||||||
shutdown(),
|
shutdown(),
|
||||||
restart(),
|
restart(),
|
||||||
// Fun
|
// Fun
|
||||||
meow(),
|
meow(),
|
||||||
penis(),
|
penis(),
|
||||||
|
eightball(),
|
||||||
],
|
],
|
||||||
initialize_owners: true,
|
initialize_owners: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
Loading…
Reference in New Issue
Block a user