Checkpoint
This commit is contained in:
@@ -4,28 +4,24 @@ use scc::HashSet;
|
||||
use time::UtcDateTime;
|
||||
use twilight_model::id::Id;
|
||||
|
||||
use crate::{
|
||||
database::models::{Call, Channel, Participant},
|
||||
discord::sanitizing::SanitizeDiscordMarkdown,
|
||||
extras::Extras,
|
||||
framework::commands::{
|
||||
Command, CommandError,
|
||||
arguments::{Arg, Argument, ParseArguments},
|
||||
context::CommandContext,
|
||||
permissions::Permission,
|
||||
},
|
||||
groups::calls::{
|
||||
masks::{get_mask_display_name, get_mask_emoji},
|
||||
permissions::{NonNewAccountPermission, NotBannedPermission},
|
||||
strings::{
|
||||
get_string_call_answered, get_string_call_hangup_other_party,
|
||||
get_string_call_hangup_this_party, get_string_call_no_answer,
|
||||
get_string_call_searching, get_string_tips,
|
||||
},
|
||||
},
|
||||
state::State,
|
||||
utils::Bye,
|
||||
use crate::database::models::{Call, Channel, Participant};
|
||||
use crate::discord::sanitizing::SanitizeDiscordMarkdown;
|
||||
use crate::extras::Extras;
|
||||
use crate::framework::commands::arguments::{Arg, Argument, ParseArguments};
|
||||
use crate::framework::commands::context::CommandContext;
|
||||
use crate::framework::commands::permissions::Permission;
|
||||
use crate::framework::commands::{Command, CommandError};
|
||||
use crate::groups::calls::masks::{get_mask_display_name, get_mask_emoji};
|
||||
use crate::groups::calls::permissions::{
|
||||
IsCallParticipantPermission, NonNewAccountPermission, NotBannedPermission,
|
||||
};
|
||||
use crate::groups::calls::strings::{
|
||||
get_string_call_answered, get_string_call_hangup_other_party,
|
||||
get_string_call_hangup_this_party, get_string_call_no_answer, get_string_call_searching,
|
||||
get_string_tips,
|
||||
};
|
||||
use crate::state::State;
|
||||
use crate::utils::Bye;
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct CallCommand {
|
||||
@@ -172,8 +168,9 @@ impl Command<State, Extras> for SkipCommand {
|
||||
|
||||
fn permissions(&self) -> Vec<Box<dyn Permission<State, Extras> + Send + Sync + 'static>> {
|
||||
vec![
|
||||
Box::new(NotBannedPermission),
|
||||
Box::new(NonNewAccountPermission),
|
||||
Box::new(NotBannedPermission),
|
||||
Box::new(IsCallParticipantPermission),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -318,8 +315,9 @@ impl Command<State, Extras> for HangupCommand {
|
||||
|
||||
fn permissions(&self) -> Vec<Box<dyn Permission<State, Extras> + Send + Sync + 'static>> {
|
||||
vec![
|
||||
Box::new(NotBannedPermission),
|
||||
Box::new(NonNewAccountPermission),
|
||||
Box::new(NotBannedPermission),
|
||||
Box::new(IsCallParticipantPermission),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -442,8 +440,9 @@ impl Command<State, Extras> for FriendRequestCommand {
|
||||
|
||||
fn permissions(&self) -> Vec<Box<dyn Permission<State, Extras> + Send + Sync + 'static>> {
|
||||
vec![
|
||||
Box::new(NotBannedPermission),
|
||||
Box::new(NonNewAccountPermission),
|
||||
Box::new(NotBannedPermission),
|
||||
Box::new(IsCallParticipantPermission),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -598,29 +597,28 @@ impl Command<State, Extras> for MaskCommand {
|
||||
mask_status, ctx.prefix, ctx.prefix
|
||||
);
|
||||
|
||||
if let Some(channel) = channel {
|
||||
if let Some(call_id) = channel.call_id {
|
||||
if let Some(mut participant) = Participant::get_for_user_and_channel_in_call(
|
||||
ctx.extras.user.id,
|
||||
ctx.event.channel_id.get(),
|
||||
call_id,
|
||||
&ctx.rt.state.db,
|
||||
)
|
||||
.await?
|
||||
{
|
||||
participant.is_masked = ctx.extras.user.is_masked;
|
||||
participant.upsert(&ctx.rt.state.db).await?;
|
||||
if let Some(channel) = channel
|
||||
&& let Some(call_id) = channel.call_id
|
||||
{
|
||||
if let Some(mut participant) = Participant::get_for_user_and_channel_in_call(
|
||||
ctx.extras.user.id,
|
||||
ctx.event.channel_id.get(),
|
||||
call_id,
|
||||
&ctx.rt.state.db,
|
||||
)
|
||||
.await?
|
||||
{
|
||||
participant.is_masked = ctx.extras.user.is_masked;
|
||||
participant.upsert(&ctx.rt.state.db).await?;
|
||||
|
||||
if ctx.extras.user.is_masked {
|
||||
mask_message = format!(
|
||||
"🎭 Your mask {mask_verb} set to `on`. You're currently being displayed as **{} {}**. You can toggle your mask on or off using `{}mask on` and `{}mask off`.",
|
||||
get_mask_emoji(&participant.user_mask)
|
||||
.expect("User's mask did not exist"),
|
||||
get_mask_display_name(&participant.user_mask),
|
||||
ctx.prefix,
|
||||
ctx.prefix
|
||||
);
|
||||
}
|
||||
if ctx.extras.user.is_masked {
|
||||
mask_message = format!(
|
||||
"🎭 Your mask {mask_verb} set to `on`. You're currently being displayed as **{} {}**. You can toggle your mask on or off using `{}mask on` and `{}mask off`.",
|
||||
get_mask_emoji(&participant.user_mask).expect("User's mask did not exist"),
|
||||
get_mask_display_name(&participant.user_mask),
|
||||
ctx.prefix,
|
||||
ctx.prefix
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user