add items

This commit is contained in:
2024-12-10 02:34:02 -05:00
parent d62d1feb09
commit 1db3e8b79a
7 changed files with 364 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
mod commands;
pub mod common;
pub mod inventory;
use crate::common::{Context, Error, Data};
use std::collections::HashMap;
@@ -89,6 +90,28 @@ async fn main() -> Result<(), Error> {
"#,
).execute(&database).await?;
sqlx::query(
r#"
CREATE TABLE IF NOT EXISTS games (
id BIGSERIAL PRIMARY KEY,
name CHAR[255]
)
"#
).execute(&database).await?;
sqlx::query(
r#"
CREATE TABLE IF NOT EXISTS items (
id BIGSERIAL PRIMARY KEY,
owner BIGINT NOT NULL,
game BIGINT NOT NULL,
item BIGINT NOT NULL,
data JSON NOT NULL,
name TEXT
)
"#
).execute(&database).await?;
println!("Bot is ready!");
Ok(Data {