Add colors update
This commit is contained in:
@@ -6,7 +6,7 @@ use twilight_util::builder::embed::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
constants::{COLOR_RED, COLOR_WHITE},
|
||||
constants::{COLOR_RED, COLOR_WHITE, VERSION},
|
||||
discord::{images, sanitizing::SanitizeDiscordMarkdown},
|
||||
extras::Extras,
|
||||
framework::{
|
||||
@@ -106,7 +106,7 @@ pub(super) fn get_all_command_help_embed(
|
||||
.unwrap())
|
||||
.color(COLOR_WHITE)
|
||||
.field(EmbedFieldBuilder::new("Commands", get_commands_table(rt, extras)).build())
|
||||
.footer(EmbedFooterBuilder::new(format!("v{} - Use {}help <command> to get more information about a specific command.", env!("CARGO_PKG_VERSION"), prefix)))
|
||||
.footer(EmbedFooterBuilder::new(format!("v{VERSION} - Use {}help <command> to get more information about a specific command.", prefix)))
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ use time::{Duration, UtcDateTime};
|
||||
use twilight_http::{api_error::ApiError, error::ErrorType};
|
||||
use twilight_model::{
|
||||
gateway::payload::incoming::{MessageCreate, MessageDelete, MessageUpdate},
|
||||
guild,
|
||||
id::Id,
|
||||
};
|
||||
use twilight_util::{
|
||||
@@ -165,7 +164,12 @@ impl OnMessageHandler<State, Extras> for CallMessageHandler {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let mut user = User::create_or_update(event.author.clone(), &rt.state.db).await?;
|
||||
let mut user = User::create_or_update(
|
||||
event.author.clone(),
|
||||
&rt.state.db,
|
||||
&rt.state.color_queue_sender,
|
||||
)
|
||||
.await?;
|
||||
|
||||
let user_incidents = UserIncident::get_for_user(event.author.id.get(), &rt.state.db)
|
||||
.await?
|
||||
@@ -307,18 +311,18 @@ impl OnMessageHandler<State, Extras> for CallMessageHandler {
|
||||
.zip(replying_to.data.propagation_message_id)
|
||||
{
|
||||
let (display_name, avatar_url) =
|
||||
if let Some(mask) = replying_to.data.author_mask {
|
||||
if let Some(mask) = &replying_to.data.author_mask {
|
||||
(
|
||||
if i64_to_u64(propagation_channel_id) != event.channel_id.get() {
|
||||
get_mask_display_name(&mask)
|
||||
get_mask_display_name(mask)
|
||||
} else {
|
||||
format!(
|
||||
"{} ({})",
|
||||
get_mask_display_name(&mask),
|
||||
get_mask_display_name(mask),
|
||||
replying_to.data.author_name
|
||||
)
|
||||
},
|
||||
get_mask_avatar_url(&mask).expect("Failed to get mask avatar URL"),
|
||||
get_mask_avatar_url(mask).expect("Failed to get mask avatar URL"),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
@@ -339,6 +343,9 @@ impl OnMessageHandler<State, Extras> for CallMessageHandler {
|
||||
)
|
||||
};
|
||||
|
||||
let replying_to_user =
|
||||
User::get_by_id(replying_to.author_id, &rt.state.db).await?;
|
||||
|
||||
embeds.push(
|
||||
EmbedBuilder::new()
|
||||
.author(
|
||||
@@ -346,7 +353,15 @@ impl OnMessageHandler<State, Extras> for CallMessageHandler {
|
||||
.icon_url(ImageSource::url(avatar_url).unwrap())
|
||||
.url(message_link),
|
||||
)
|
||||
.color(COLOR_WHITE)
|
||||
.color(
|
||||
if replying_to.data.author_mask.is_some() {
|
||||
COLOR_WHITE
|
||||
} else {
|
||||
replying_to_user
|
||||
.and_then(|i| i.color.map(|c| c as u32))
|
||||
.unwrap_or(COLOR_WHITE)
|
||||
}
|
||||
)
|
||||
.description(ellipse(replying_to.data.content, 100))
|
||||
.build(),
|
||||
);
|
||||
@@ -508,7 +523,12 @@ impl OnMessageEditHandler<State, Extras> for CallMessageEditHandler {
|
||||
.reply(event.id)
|
||||
.await?;
|
||||
|
||||
let user = User::create_or_update(event.author.clone(), &rt.state.db).await?;
|
||||
let user = User::create_or_update(
|
||||
event.author.clone(),
|
||||
&rt.state.db,
|
||||
&rt.state.color_queue_sender,
|
||||
)
|
||||
.await?;
|
||||
|
||||
penalize_user(user, message, rules, &rt).await?;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ ngiga
|
||||
ngigas
|
||||
negaras
|
||||
nigy
|
||||
nyga
|
||||
diga
|
||||
digas
|
||||
fag
|
||||
|
||||
Reference in New Issue
Block a user