Add peko alias and easteregg

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/2/head
trivernis 3 years ago
parent cdeeb2e78d
commit 60f300913d
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -10,6 +10,7 @@ static MESSAGE_DELIMITERS: &[char] = &['.', '?', '!', '"'];
#[description("Pekofy messages")]
#[usage("(<content>)")]
#[example("Hello")]
#[aliases("peko")]
async fn pekofy(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
let mut reference_message = msg.id;
let mut content = args.message().to_string();
@ -37,12 +38,20 @@ async fn pekofy(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
}
log::debug!("Pekofying message '{}'", content);
let pekofied: String = content
.lines()
.into_iter()
.map(pekofy_line)
.collect::<Vec<String>>()
.join("\n");
let mut alpha_lowercase = content.to_lowercase();
alpha_lowercase.retain(|c| c.is_alphanumeric());
let pekofied: String = if alpha_lowercase == "pain" {
"https://tenor.com/view/pekora-usada-peko-hololive-died-gif-18114577".to_string()
} else {
content
.lines()
.into_iter()
.map(pekofy_line)
.collect::<Vec<String>>()
.join("\n")
};
let message = ctx
.http
.get_message(msg.channel_id.0, reference_message.0)

Loading…
Cancel
Save