fix: role_current needednt have been an Option
This commit is contained in:
parent
e9aed40f41
commit
11240914ac
4 changed files with 22 additions and 33 deletions
|
@ -39,7 +39,7 @@ pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> Stri
|
|||
.as_ref()
|
||||
.expect("Expected role object")
|
||||
{
|
||||
Some(role.id.to_owned())
|
||||
role.id.to_owned()
|
||||
} else {
|
||||
return "Please provide a valid role for ``Role Current``".to_string();
|
||||
};
|
||||
|
@ -175,7 +175,6 @@ pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicatio
|
|||
async fn add_server(db: &Pool<Sqlite>, ctx: &Context, server: &Servers) -> Result<Option<Servers>, Error> {
|
||||
let existing = get_server_config(db, &server.server).await;
|
||||
let role_past = server.role_past.map(|x| *x.as_u64() as i64);
|
||||
let role_current = server.role_current.map(|x| *x.as_u64() as i64);
|
||||
|
||||
let insert = sqlx::query_as::<_, Servers>(
|
||||
"
|
||||
|
@ -186,7 +185,7 @@ async fn add_server(db: &Pool<Sqlite>, ctx: &Context, server: &Servers) -> Resul
|
|||
.bind(*server.server.as_u64() as i64)
|
||||
.bind(&server.wolves_api)
|
||||
.bind(role_past)
|
||||
.bind(role_current)
|
||||
.bind(*server.role_current.as_u64() as i64)
|
||||
.bind(*server.bot_channel_id.as_u64() as i64)
|
||||
.bind(&server.server_name)
|
||||
.bind(&server.wolves_link)
|
||||
|
@ -204,7 +203,7 @@ async fn add_server(db: &Pool<Sqlite>, ctx: &Context, server: &Servers) -> Resul
|
|||
if x.role_current != server.role_current {
|
||||
result.0 = true;
|
||||
result.1 = true;
|
||||
result.2 = x.role_current;
|
||||
result.2 = Some(x.role_current);
|
||||
}
|
||||
if x.role_past != server.role_past {
|
||||
result.0 = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue