aboutsummaryrefslogtreecommitdiff
path: root/src/commands/meme
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/meme')
-rw-r--r--src/commands/meme/create.rs6
-rw-r--r--src/commands/meme/delete.rs4
-rw-r--r--src/commands/meme/history.rs23
-rw-r--r--src/commands/meme/invoke.rs47
-rw-r--r--src/commands/meme/mod.rs1
5 files changed, 41 insertions, 40 deletions
diff --git a/src/commands/meme/create.rs b/src/commands/meme/create.rs
index cad9bfc..e2eacbf 100644
--- a/src/commands/meme/create.rs
+++ b/src/commands/meme/create.rs
@@ -28,7 +28,8 @@ use crate::{
FFMPEG_COMMAND,
};
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes")]
+/// Add a text/image meme to the db.
+#[poise::command(prefix_command, guild_only, category = "memes")]
pub async fn addmeme(
ctx: PoiseContext<'_>,
title: String,
@@ -94,7 +95,8 @@ pub async fn addmeme(
Ok(())
}
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes")]
+/// Add an audiomeme to the meme db.
+#[poise::command(prefix_command, guild_only, category = "memes")]
pub async fn addaudiomeme(
ctx: PoiseContext<'_>,
title: String,
diff --git a/src/commands/meme/delete.rs b/src/commands/meme/delete.rs
index 25ddf0d..4769cc8 100644
--- a/src/commands/meme/delete.rs
+++ b/src/commands/meme/delete.rs
@@ -10,12 +10,12 @@ use crate::{
connection,
delete_meme,
},
- msg,
util,
PoiseContext,
};
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes", aliases("delmem"))]
+/// Delete a meme by name.
+#[poise::command(prefix_command, guild_only, category = "memes", aliases("delmem"))]
pub async fn delmeme(ctx: PoiseContext<'_>, title: String) -> anyhow::Result<()> {
let mut conn = connection().await?;
diff --git a/src/commands/meme/history.rs b/src/commands/meme/history.rs
index cfd78df..335603f 100644
--- a/src/commands/meme/history.rs
+++ b/src/commands/meme/history.rs
@@ -48,13 +48,8 @@ lazy_static! {
static CLEAN_DATE_FORMAT: &str = "%b %-e %Y";
-#[poise::command(
- slash_command,
- prefix_command,
- guild_only,
- category = "memes",
- aliases("what", "hwaet", "hwæt")
-)]
+/// Print info about the last meme.
+#[poise::command(prefix_command, guild_only, category = "memes", aliases("what", "hwaet", "hwæt"))]
pub async fn wat(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
let mut conn = connection().await?;
@@ -108,7 +103,8 @@ pub async fn wat(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
Ok(())
}
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes", aliases("hist"))]
+/// Print recent memes and who invoked them.
+#[poise::command(prefix_command, guild_only, category = "memes", aliases("hist"))]
pub async fn history(ctx: PoiseContext<'_>, n: Option<usize>) -> anyhow::Result<()> {
let n = n.unwrap_or(CONFIG.default_hist);
@@ -204,7 +200,8 @@ pub async fn history(ctx: PoiseContext<'_>, n: Option<usize>) -> anyhow::Result<
Ok(())
}
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes", aliases("stat"))]
+/// Print stats about the meme database.
+#[poise::command(prefix_command, guild_only, category = "memes", aliases("stat"))]
pub async fn stats(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
use db;
use serenity::model::{
@@ -276,7 +273,8 @@ and *{}* was the most-memed overall ({})"#,
Ok(())
}
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes")]
+/// Print stats about memers.
+#[poise::command(prefix_command, guild_only, category = "memes")]
pub async fn memers(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
use serenity::model::id::UserId;
@@ -310,6 +308,11 @@ pub async fn memers(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
Ok(())
}
+/// Look up a meme by title or content.
+///
+/// Can pass:
+/// - `by=username` or `creator=username` to look up memes created by a specific user.
+/// - `age=new` or `age=old` to sort the result by age.
#[poise::command(prefix_command, guild_only, category = "memes")]
pub async fn query(ctx: PoiseContext<'_>, rest: util::RestVec) -> anyhow::Result<()> {
use regex::Regex;
diff --git a/src/commands/meme/invoke.rs b/src/commands/meme/invoke.rs
index e399e82..31b0085 100644
--- a/src/commands/meme/invoke.rs
+++ b/src/commands/meme/invoke.rs
@@ -14,48 +14,50 @@ use crate::{
},
util,
PoiseContext,
+ RestVec,
};
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes", aliases("mem"))]
-pub async fn meme(ctx: PoiseContext<'_>, #[rest] rest: String) -> anyhow::Result<()> {
- _meme(ctx, rest, AudioPlayback::Optional).await
+/// Post a meme.
+#[poise::command(prefix_command, guild_only, category = "memes", aliases("mem"))]
+pub async fn meme(ctx: PoiseContext<'_>, title: RestVec) -> anyhow::Result<()> {
+ let title = title.into_inner().join(" ");
+
+ _meme(ctx, title.trim(), AudioPlayback::Optional).await
}
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes")]
+/// Post a random omen.
+#[poise::command(prefix_command, guild_only, category = "memes", discard_spare_arguments)]
pub async fn omen(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
_meme(ctx, "", AudioPlayback::Optional).await
}
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes")]
+/// Post a random omen without audio.
+#[poise::command(prefix_command, guild_only, category = "memes", discard_spare_arguments)]
pub async fn silentomen(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
_meme(ctx, "", AudioPlayback::Prohibited).await
}
-#[poise::command(slash_command, prefix_command, guild_only, category = "memes")]
+/// Post a random omen with audio.
+#[poise::command(prefix_command, guild_only, category = "memes", discard_spare_arguments)]
pub async fn audioomen(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
_meme(ctx, "", AudioPlayback::Required).await
}
-#[poise::command(
- slash_command,
- prefix_command,
- guild_only,
- category = "memes",
- aliases("audiomeme", "audiomem")
-)]
-pub async fn audio_meme(ctx: PoiseContext<'_>, #[rest] rest: String) -> anyhow::Result<()> {
- _meme(ctx, rest, AudioPlayback::Required).await
+/// Post a random meme with audio.
+#[poise::command(prefix_command, guild_only, category = "memes", aliases("audiomeme", "audiomem"))]
+pub async fn audio_meme(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
+ _meme(ctx, "", AudioPlayback::Required).await
}
+/// Post a random meme without audio.
#[poise::command(
- slash_command,
prefix_command,
guild_only,
category = "memes",
aliases("silentmeme", "silentmem")
)]
-pub async fn silent_meme(ctx: PoiseContext<'_>, #[rest] rest: String) -> anyhow::Result<()> {
- _meme(ctx, rest, AudioPlayback::Prohibited).await
+pub async fn silent_meme(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
+ _meme(ctx, "", AudioPlayback::Prohibited).await
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
@@ -132,13 +134,8 @@ async fn rand_meme(ctx: PoiseContext<'_>, audio_playback: AudioPlayback) -> anyh
}
}
-#[poise::command(
- slash_command,
- prefix_command,
- guild_only,
- category = "memes",
- aliases("raremem", "rarememe")
-)]
+/// Post a rare meme.
+#[poise::command(prefix_command, guild_only, category = "memes", aliases("raremem", "rarememe"))]
pub async fn rare_meme(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
let should_audio = util::users_listening(ctx.serenity_context()).await?;
diff --git a/src/commands/meme/mod.rs b/src/commands/meme/mod.rs
index 0108219..9495ec7 100644
--- a/src/commands/meme/mod.rs
+++ b/src/commands/meme/mod.rs
@@ -32,7 +32,6 @@ use crate::{
Audio,
Meme,
},
- msg,
util,
PoiseContext,
CONFIG,