Skip to content

Commit

Permalink
Post April first clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Kile committed Apr 1, 2024
1 parent 2b4ac05 commit 2af380f
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions src/events/dot_remover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,21 +328,20 @@ impl EventHandler for DotHandler {
return;
}
// Check if the message is fron a user with an exluded role
// if msg
// .author
// .has_role(&ctx.http, msg.guild_id.unwrap(), EXLUDED)
// .await
// .unwrap_or(false)
// {
// return;
// }
// NO ONE MAY BE SPARED
if msg
.author
.has_role(&ctx.http, msg.guild_id.unwrap(), EXLUDED)
.await
.unwrap_or(false)
{
return;
}

// Figure out if it ends with a single dot and only has one
// sentence using regex
let text = find_if_dot(&msg.clone().content);
// If it does, remove the dot and send the message
if !text.is_some() {
if text.is_some() {
// Create a webhook in current channel
let webhook = msg
.channel_id
Expand All @@ -360,7 +359,7 @@ impl EventHandler for DotHandler {

let http = Http::new("");
let builder = ExecuteWebhook::new()
.content(msg.content.clone() + ".") // LET THERE BE DOTS
.content(text.unwrap())
.username(&name)
.avatar_url(&avatar);
webhook
Expand Down Expand Up @@ -394,23 +393,22 @@ impl EventHandler for DotHandler {
return;
}
// Check if the message is fron a user with an exluded role
// if event
// .clone()
// .author
// .unwrap()
// .has_role(&ctx.http, event.clone().guild_id.unwrap(), EXLUDED)
// .await
// .unwrap_or(false)
// {
// return;
// }
// NO ONE MAY BE SPARED
if event
.clone()
.author
.unwrap()
.has_role(&ctx.http, event.clone().guild_id.unwrap(), EXLUDED)
.await
.unwrap_or(false)
{
return;
}

// Figure out if it ends with a single dot and only has one
// sentence using regex
let text = find_if_dot(&event.clone().content.unwrap());
// If it does, remove the dot and send the message
if !text.is_some() {
if text.is_some() {
// Create a webhook in current channel
let webhook = event
.clone()
Expand Down Expand Up @@ -443,7 +441,7 @@ impl EventHandler for DotHandler {
};

let builder = ExecuteWebhook::new()
.content(event.clone().content.unwrap() + ".") // LET THERE BE DOTS
.content(text.unwrap())
.username(&name)
.avatar_url(&avatar);
webhook
Expand Down

0 comments on commit 2af380f

Please sign in to comment.