feat: added support for multiple minecraft servers per discord server
Closes #9
This commit is contained in:
parent
c446c10f2d
commit
0f774258a1
4 changed files with 66 additions and 53 deletions
|
@ -63,9 +63,7 @@ pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> Stri
|
|||
role_past,
|
||||
role_current,
|
||||
member_past: 0,
|
||||
member_current: 0,
|
||||
// this gets added later
|
||||
server_minecraft: None,
|
||||
member_current: 0
|
||||
};
|
||||
|
||||
match add_server(&db, ctx, &server_data).await {
|
||||
|
@ -111,22 +109,16 @@ async fn add_server(db: &Pool<Sqlite>, ctx: &Context, server: &Servers) -> Resul
|
|||
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 server_minecraft = match get_server_config(db, &server.server).await {
|
||||
None => None,
|
||||
Some(x) => x.server_minecraft,
|
||||
};
|
||||
|
||||
let insert = sqlx::query_as::<_, Servers>(
|
||||
"
|
||||
INSERT OR REPLACE INTO servers (server, wolves_api, role_past, role_current, server_minecraft)
|
||||
VALUES (?1, ?2, ?3, ?4, ?5)
|
||||
INSERT OR REPLACE INTO servers (server, wolves_api, role_past, role_current)
|
||||
VALUES (?1, ?2, ?3, ?4)
|
||||
",
|
||||
)
|
||||
.bind(*server.server.as_u64() as i64)
|
||||
.bind(&server.wolves_api)
|
||||
.bind(role_past)
|
||||
.bind(role_current)
|
||||
.bind(server_minecraft)
|
||||
.fetch_optional(db)
|
||||
.await;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue