summaryrefslogtreecommitdiff
path: root/src/commands/bottom_encode.rs
blob: 741adc703520022734c2aae80c21704ad156b682 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use crate::utils;
use serenity::builder::CreateApplicationCommand;
use serenity::model::prelude::command::CommandOptionType;
use serenity::model::prelude::interaction::application_command::{
	CommandDataOption, CommandDataOptionValue,
};

pub async fn run(options: &[CommandDataOption]) -> String {
	let err_msg = "expected a copyasta";
	let option = options
		.get(0)
		.expect(err_msg)
		.resolved
		.as_ref()
		.expect(err_msg);

	if let CommandDataOptionValue::String(msg) = option {
		return utils::bottom_encode(msg).await;
	}

	"did you forget to enter a message?".to_string()
}

pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
	command
		.name("bottom_encode")
		.description("teawie will translate something to bottom for you 🥺")
		.create_option(|option| {
			option
				.name("message")
				.description("what you want teawie to translate")
				.kind(CommandOptionType::String)
				.required(true)
		})
}