restructured cmds.rs to multiple files

This commit is contained in:
2025-06-05 23:15:55 +02:00
parent 823a354a6b
commit 7922bc50a9
14 changed files with 529 additions and 522 deletions
+26
View File
@@ -0,0 +1,26 @@
use crate::{lang, messages::send_msg, re_cmds::generic_fns::to_shorturl, Context, Error};
#[poise::command(
slash_command,
prefix_command,
rename = "re_shorturl",
required_bot_permissions = "SEND_MESSAGES | VIEW_CHANNEL"
)]
/// Convert a long reddit URL to a short one. The bot ONLY uses shortURLs when asking for one.
pub async fn cmd(
ctx: Context<'_>,
#[description = "A Reddit post URL"] url: String
) -> Result<(), Error>
{
let shorturl = to_shorturl(&url);
if shorturl.is_ok() {
send_msg(ctx, lang!("dc_msg_shorturl", shorturl.unwrap()), true, true).await;
}
else {
send_msg(ctx, lang!("dc_msg_failed_shorturl_conversion"), true, true).await;
}
return Ok(());
}