fix: role id is non zero u64
This commit is contained in:
parent
cf83ccbd6e
commit
bf34d95197
@ -70,18 +70,23 @@ pub async fn create(
|
||||
.color(colour::Color::RED)
|
||||
} else {
|
||||
let concour = concour.unwrap();
|
||||
CreateEmbed::new()
|
||||
let output = CreateEmbed::new()
|
||||
.title(concour.title)
|
||||
.description(concour.description)
|
||||
.field("Start date", concour.start_date.to_string(), false)
|
||||
.field("Periode", concour.periode.to_string(), false)
|
||||
.field(
|
||||
.color(colour::Color::DARK_GREEN);
|
||||
if concour.role_recompense == 0 {
|
||||
output
|
||||
} else {
|
||||
output.field(
|
||||
"Role récompense",
|
||||
RoleId::new(concour.role_recompense).mention().to_string(),
|
||||
false,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(err) => match err {
|
||||
CreateConcourError::AlreadyExist => CreateEmbed::new()
|
||||
.title("Concour already exist")
|
||||
|
@ -66,19 +66,20 @@ pub async fn list(ctx: Context<'_>) -> Result<(), Error> {
|
||||
.title("Concour list")
|
||||
.color(colour::Color::DARK_GREEN)];
|
||||
concour.into_iter().for_each(|c| {
|
||||
list.push(
|
||||
CreateEmbed::new()
|
||||
let mut output = CreateEmbed::new()
|
||||
.title(c.title)
|
||||
.description(c.description)
|
||||
.field("Start date", c.start_date.to_string(), false)
|
||||
.field("Periode", c.periode.to_string(), false)
|
||||
.field(
|
||||
.footer(footer.clone());
|
||||
if c.role_recompense != 0 {
|
||||
output = output.field(
|
||||
"Role récompense",
|
||||
RoleId::new(c.role_recompense).mention().to_string(),
|
||||
false,
|
||||
)
|
||||
.footer(footer.clone()),
|
||||
);
|
||||
}
|
||||
list.push(output);
|
||||
});
|
||||
list
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::botv2::{
|
||||
cmd::concour::{list::list, update::update},
|
||||
cmd::concour::{create::create, list::list, update::update},
|
||||
domain::concour::{
|
||||
check_if_allowed::check_if_concour_allowed, get_channel_concour::get_channel_concour,
|
||||
},
|
||||
@ -17,7 +17,7 @@ use tracing::instrument;
|
||||
slash_command,
|
||||
prefix_command,
|
||||
category = "concour",
|
||||
subcommands("get", "list", "update"),
|
||||
subcommands("get", "list", "update", "create"),
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn concour(
|
||||
@ -85,18 +85,22 @@ async fn concour_get(ctx: Context<'_>, ephemeral: Option<bool>) -> Result<(), Er
|
||||
let concour = match get_channel_concour(guild.get(), ctx.channel_id().get()).await {
|
||||
Ok(concour) => {
|
||||
if let Some(concour) = concour {
|
||||
CreateEmbed::new()
|
||||
let mut output = CreateEmbed::new()
|
||||
.title("Concour")
|
||||
.field("Title", concour.title, false)
|
||||
.field("Description", concour.description, false)
|
||||
.field("Start date", concour.start_date.to_string(), false)
|
||||
.field("Periode", concour.periode.to_string(), false)
|
||||
.field(
|
||||
.color(colour::Color::DARK_GREEN);
|
||||
|
||||
if concour.role_recompense != 0 {
|
||||
output = output.field(
|
||||
"Role récompense",
|
||||
RoleId::new(concour.role_recompense).mention().to_string(),
|
||||
false,
|
||||
)
|
||||
.color(colour::Color::DARK_GREEN)
|
||||
);
|
||||
}
|
||||
output
|
||||
} else {
|
||||
CreateEmbed::new()
|
||||
.title("No concour found in this channel")
|
||||
|
@ -26,7 +26,7 @@ Provided by Batleforc with ❤️ and too much ☕";
|
||||
|
||||
let config = HelpConfiguration {
|
||||
show_subcommands: true,
|
||||
show_context_menu_commands: true,
|
||||
show_context_menu_commands: false,
|
||||
ephemeral: true,
|
||||
extra_text_at_bottom,
|
||||
|
||||
|
@ -45,7 +45,7 @@ impl Default for Concour {
|
||||
title: String::new(),
|
||||
description: String::new(),
|
||||
start_date: chrono::Utc::now(),
|
||||
periode: time::Duration::days(0),
|
||||
periode: time::Duration::days(1),
|
||||
role_recompense: 0,
|
||||
keywords: Vec::new(),
|
||||
banner: None,
|
||||
|
Loading…
Reference in New Issue
Block a user