feat: split out all the databse interactions into their own file

This commit is contained in:
silver 2024-10-28 00:59:04 +00:00
parent 79f880daea
commit 41407ecefb
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
12 changed files with 348 additions and 318 deletions

View file

@ -7,7 +7,7 @@ use serenity::{
},
};
use skynet_discord_bot::DataBase;
use skynet_discord_bot::common::database::DataBase;
use sqlx::{Pool, Sqlite};
pub(crate) mod user {
@ -16,8 +16,9 @@ pub(crate) mod user {
use super::*;
use crate::commands::link_email::link::get_server_member_discord;
use serenity::model::id::UserId;
use skynet_discord_bot::{whitelist_update, Config, Minecraft, Wolves};
use skynet_discord_bot::{whitelist_update, Config};
use sqlx::Error;
use skynet_discord_bot::common::database::{Minecraft, Wolves};
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
command.name("link_minecraft").description("Link your minecraft account").create_option(|option| {
@ -122,7 +123,8 @@ pub(crate) mod server {
use sqlx::Error;
// this is to managfe the server side of commands related to minecraft
use super::*;
use skynet_discord_bot::{is_admin, update_server, Config, Minecraft};
use skynet_discord_bot::{is_admin, update_server, Config};
use skynet_discord_bot::common::database::Minecraft;
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
command.name("minecraft_add").description("Add a minecraft server").create_option(|option| {
@ -201,7 +203,8 @@ pub(crate) mod server {
use serenity::builder::CreateApplicationCommand;
use serenity::client::Context;
use serenity::model::prelude::application_command::ApplicationCommandInteraction;
use skynet_discord_bot::{get_minecraft_config_server, is_admin, server_information, Config, DataBase};
use skynet_discord_bot::{get_minecraft_config_server, is_admin, server_information, Config};
use skynet_discord_bot::common::database::DataBase;
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
command.name("minecraft_list").description("List your minecraft servers")
@ -262,8 +265,9 @@ pub(crate) mod server {
use serenity::model::application::command::CommandOptionType;
use serenity::model::id::GuildId;
use serenity::model::prelude::application_command::{ApplicationCommandInteraction, CommandDataOptionValue};
use skynet_discord_bot::{is_admin, DataBase, Minecraft};
use skynet_discord_bot::is_admin;
use sqlx::{Error, Pool, Sqlite};
use skynet_discord_bot::common::database::{DataBase, Minecraft};
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
command.name("minecraft_delete").description("Delete a minecraft server").create_option(|option| {