cleanup
This commit is contained in:
parent
9ff0c0ef37
commit
c0f300a958
5 changed files with 0 additions and 110 deletions
65
src/ayy.rs
65
src/ayy.rs
|
|
@ -1,65 +0,0 @@
|
|||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
use serenity::all::{Context, EventHandler, Message};
|
||||
use serenity::async_trait;
|
||||
|
||||
static AY_REGEX: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new("(^|\\s)[Aa][Yy]+($|\\s)").expect("invalid regex"));
|
||||
pub struct AyyHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl EventHandler for AyyHandler {
|
||||
async fn message(&self, ctx: Context, msg: Message) {
|
||||
if msg.author.bot{
|
||||
return;
|
||||
}
|
||||
|
||||
if AY_REGEX.is_match(&msg.content){
|
||||
let mut output = "".to_owned();
|
||||
let mut lastpos = 0;
|
||||
for ay in AY_REGEX.find_iter(&msg.content){
|
||||
output += &msg.content[lastpos..ay.start()];
|
||||
|
||||
lastpos = ay.end();
|
||||
|
||||
let mut str = ay.as_str();
|
||||
|
||||
if str.starts_with(' '){
|
||||
str = &str[1..];
|
||||
output.push(' ');
|
||||
}
|
||||
|
||||
let mut chars = str.chars();
|
||||
|
||||
let Some(first_char) = chars.next() else{
|
||||
return
|
||||
};
|
||||
|
||||
if first_char.is_lowercase(){
|
||||
output.push_str("lma")
|
||||
} else {
|
||||
output.push_str("LMA")
|
||||
}
|
||||
|
||||
for char in chars{
|
||||
if char == ' '{
|
||||
output.push(' ');
|
||||
break;
|
||||
}
|
||||
|
||||
if char.is_lowercase(){
|
||||
output.push('o');
|
||||
} else {
|
||||
output.push('O');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
output += &msg.content[lastpos..];
|
||||
|
||||
msg.reply(&ctx.http, output).await.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
use serenity::all::{Context, CreateCommand, EventHandler, Message};
|
||||
use serenity::async_trait;
|
||||
use crate::error_codes::ErrorCodeHandler;
|
||||
|
||||
static CHEESEBURGER_REGEX: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new("[Cc]heeseburger(s)?").expect("invalid regex"));
|
||||
pub struct CheeseburgerHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl EventHandler for CheeseburgerHandler {
|
||||
async fn message(&self, ctx: Context, msg: Message) {
|
||||
if msg.author.bot{
|
||||
return;
|
||||
}
|
||||
|
||||
if CHEESEBURGER_REGEX.is_match(&msg.content){
|
||||
msg.reply(&ctx.http, "currently scratching the FUCK out of my bum bum idgaf").await.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
mod ayy;
|
||||
mod cheeseburger;
|
||||
mod emergency_report;
|
||||
mod error_codes;
|
||||
mod fest_fax;
|
||||
mod miiverse_mod_application;
|
||||
mod too_fat;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
use crate::cheeseburger::CheeseburgerHandler;
|
||||
use serenity::all::{ActivityData, ActivityType, ChannelId, Colour, Command, CommandId, Context, CreateCommand, CreateEmbed, CreateEmbedAuthor, CreateInputText, CreateInteractionResponse, CreateInteractionResponseMessage, CreateMessage, CreateQuickModal, EventHandler, Guild, GuildId, InputTextStyle, Interaction, Message, Ready, Timestamp};
|
||||
use serenity::async_trait;
|
||||
use tokio::sync::OnceCell;
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
use std::time::Duration;
|
||||
use serenity::all::{Context, EventHandler, Message};
|
||||
use serenity::async_trait;
|
||||
use tokio::time::sleep;
|
||||
|
||||
pub struct TooFatHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl EventHandler for TooFatHandler {
|
||||
async fn message(&self, ctx: Context, msg: Message) {
|
||||
if msg.content.contains("151-0204") {
|
||||
tokio::spawn(async move {
|
||||
sleep(Duration::from_secs(1)).await;
|
||||
|
||||
msg.reply(&ctx.http, "in other words your too fat").await.ok();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue