Add strings to call commands
This commit is contained in:
@@ -8,7 +8,15 @@ use crate::{
|
||||
framework::commands::{
|
||||
Command, CommandError, context::CommandContext, permissions::Permission,
|
||||
},
|
||||
groups::calls::{get_display_profile, permissions::NotBannedPermission},
|
||||
groups::calls::{
|
||||
get_display_profile,
|
||||
permissions::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,
|
||||
};
|
||||
@@ -99,16 +107,28 @@ impl Command<State> for CallCommand {
|
||||
.await;
|
||||
|
||||
if let Some(call) = call {
|
||||
ctx.send().content("☎️ Call connected. Say hi!").await.bye();
|
||||
ctx.send()
|
||||
.content(format!(
|
||||
"**TIP:** {}\n☎️ {}\n☎️ {}",
|
||||
get_string_tips(ctx.prefix),
|
||||
get_string_call_searching(ctx.prefix),
|
||||
get_string_call_answered(ctx.prefix)
|
||||
))
|
||||
.await
|
||||
.bye();
|
||||
ctx.rt
|
||||
.http
|
||||
.create_message(Id::new(call.other_party_channel_id(channel.id)))
|
||||
.content("☎️ Call connected. Say hi!")
|
||||
.content(&format!("☎️ {}", get_string_call_answered(ctx.prefix)))
|
||||
.await
|
||||
.bye();
|
||||
} else {
|
||||
ctx.send()
|
||||
.content("☎️ Searching for a call...")
|
||||
.content(format!(
|
||||
"**TIP:** {}\n☎️ {}",
|
||||
get_string_tips(ctx.prefix),
|
||||
get_string_call_searching(ctx.prefix)
|
||||
))
|
||||
.await
|
||||
.map_err(|_| CommandError::MessageSendingFailed)?;
|
||||
}
|
||||
@@ -190,7 +210,10 @@ impl Command<State> for SkipCommand {
|
||||
ctx.rt
|
||||
.http
|
||||
.create_message(Id::new(other_channel_id))
|
||||
.content("☎️ The other party hung up the phone.")
|
||||
.content(&format!(
|
||||
"☎️ {}",
|
||||
get_string_call_hangup_other_party(ctx.prefix)
|
||||
))
|
||||
.await
|
||||
.inspect_err(|e| {
|
||||
log::error!("Failed to send message to other party: {e:?}");
|
||||
@@ -205,11 +228,20 @@ impl Command<State> for SkipCommand {
|
||||
.map_err(|_| CommandError::DatabaseQueryFailed)?;
|
||||
|
||||
if let Some(call) = call {
|
||||
ctx.send().content("☎️ Call connected. Say hi!").await.bye();
|
||||
ctx.send()
|
||||
.content(format!(
|
||||
"☎️ {}",
|
||||
get_string_call_hangup_this_party(ctx.prefix)
|
||||
))
|
||||
.await
|
||||
.bye();
|
||||
ctx.rt
|
||||
.http
|
||||
.create_message(Id::new(call.other_party_channel_id(channel.id)))
|
||||
.content("☎️ Call connected. Say hi!")
|
||||
.content(&format!(
|
||||
"☎️ {}",
|
||||
get_string_call_hangup_other_party(ctx.prefix)
|
||||
))
|
||||
.await
|
||||
.bye();
|
||||
} else {
|
||||
@@ -271,7 +303,7 @@ impl Command<State> for HangupCommand {
|
||||
.map_err(|_| CommandError::DatabaseQueryFailed)?;
|
||||
|
||||
ctx.send()
|
||||
.content("☎️ The phone was hung up.")
|
||||
.content(format!("☎️ {}", get_string_call_no_answer(ctx.prefix)))
|
||||
.await
|
||||
.map_err(|_| CommandError::MessageSendingFailed)?;
|
||||
|
||||
@@ -297,12 +329,21 @@ impl Command<State> for HangupCommand {
|
||||
.inspect_err(|e| log::error!("Failed to hang up call: {e:?}"))
|
||||
.map_err(|_| CommandError::DatabaseQueryFailed)?;
|
||||
|
||||
ctx.send().content("☎️ You hung up the phone.").await.bye();
|
||||
ctx.send()
|
||||
.content(format!(
|
||||
"☎️ {}",
|
||||
get_string_call_hangup_this_party(ctx.prefix)
|
||||
))
|
||||
.await
|
||||
.bye();
|
||||
|
||||
ctx.rt
|
||||
.http
|
||||
.create_message(Id::new(call.other_party_channel_id(channel.id)))
|
||||
.content("☎️ The other party hung up the phone.")
|
||||
.content(&format!(
|
||||
"☎️ {}",
|
||||
get_string_call_hangup_other_party(ctx.prefix)
|
||||
))
|
||||
.await
|
||||
.map_err(|_| CommandError::MessageSendingFailed)?;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user