diff --git a/geoffrey_bot/src/commands/add_item.rs b/geoffrey_bot/src/bot/commands/add_item.rs similarity index 98% rename from geoffrey_bot/src/commands/add_item.rs rename to geoffrey_bot/src/bot/commands/add_item.rs index 72ddd57..73787fd 100644 --- a/geoffrey_bot/src/commands/add_item.rs +++ b/geoffrey_bot/src/bot/commands/add_item.rs @@ -1,7 +1,4 @@ -use crate::commands::bot_command::{BotCommand, CommandError}; use async_trait::async_trait; -use geoffrey_models::models::locations::Location; -use geoffrey_models::models::parameters::add_item_params::AddItemParams; use reqwest::Method; use serenity::client::Context; use serenity::model::interactions::application_command::{ @@ -9,6 +6,11 @@ use serenity::model::interactions::application_command::{ }; use serenity::model::prelude::application_command::ApplicationCommandInteractionDataOptionValue; +use geoffrey_models::models::locations::Location; +use geoffrey_models::models::parameters::add_item_params::AddItemParams; + +use crate::bot::commands::{BotCommand, CommandError}; + pub struct AddItemCommand; #[async_trait] diff --git a/geoffrey_bot/src/commands/add_location.rs b/geoffrey_bot/src/bot/commands/add_location.rs similarity index 99% rename from geoffrey_bot/src/commands/add_location.rs rename to geoffrey_bot/src/bot/commands/add_location.rs index d17e509..eda9c30 100644 --- a/geoffrey_bot/src/commands/add_location.rs +++ b/geoffrey_bot/src/bot/commands/add_location.rs @@ -1,8 +1,6 @@ -use crate::commands::bot_command::{BotCommand, CommandError}; +use std::str::FromStr; + use async_trait::async_trait; -use geoffrey_models::models::locations::{Location, LocationType}; -use geoffrey_models::models::parameters::add_location_params::AddLocationParams; -use geoffrey_models::models::{Dimension, Position}; use reqwest::Method; use serenity::client::Context; use serenity::model::interactions::application_command::{ @@ -10,7 +8,12 @@ use serenity::model::interactions::application_command::{ ApplicationCommandOptionType, }; use serenity::model::prelude::application_command::ApplicationCommandInteractionDataOptionValue; -use std::str::FromStr; + +use geoffrey_models::models::{Dimension, Position}; +use geoffrey_models::models::locations::{Location, LocationType}; +use geoffrey_models::models::parameters::add_location_params::AddLocationParams; + +use crate::bot::commands::{BotCommand, CommandError}; pub struct AddLocationCommand; diff --git a/geoffrey_bot/src/commands/find.rs b/geoffrey_bot/src/bot/commands/find.rs similarity index 97% rename from geoffrey_bot/src/commands/find.rs rename to geoffrey_bot/src/bot/commands/find.rs index adf365e..e4d5179 100644 --- a/geoffrey_bot/src/commands/find.rs +++ b/geoffrey_bot/src/bot/commands/find.rs @@ -1,14 +1,17 @@ -use crate::commands::bot_command::{BotCommand, CommandError}; +use std::fmt::Write; + use async_trait::async_trait; -use geoffrey_models::models::locations::Location; -use geoffrey_models::models::parameters::find_params::FindParams; use reqwest::Method; use serenity::client::Context; use serenity::model::interactions::application_command::{ ApplicationCommand, ApplicationCommandInteraction, ApplicationCommandOptionType, }; use serenity::model::prelude::application_command::ApplicationCommandInteractionDataOptionValue; -use std::fmt::Write; + +use geoffrey_models::models::locations::Location; +use geoffrey_models::models::parameters::find_params::FindParams; + +use crate::bot::commands::{BotCommand, CommandError}; pub struct FindCommand; diff --git a/geoffrey_bot/src/commands/bot_command.rs b/geoffrey_bot/src/bot/commands/mod.rs similarity index 95% rename from geoffrey_bot/src/commands/bot_command.rs rename to geoffrey_bot/src/bot/commands/mod.rs index f92a480..259b4a7 100644 --- a/geoffrey_bot/src/commands/bot_command.rs +++ b/geoffrey_bot/src/bot/commands/mod.rs @@ -1,17 +1,25 @@ -use crate::context::GeoffreyContext; +use std::fmt::{Display, Formatter}; + use async_trait::async_trait; +use reqwest::Error; +use serde::de::DeserializeOwned; +use serde::Serialize; +use serenity::client::Context; +use serenity::Error as SerenityError; +use serenity::model::interactions::application_command::{ApplicationCommand, ApplicationCommandInteraction}; + use geoffrey_models::models::parameters::CommandRequest; use geoffrey_models::models::player::UserID; use geoffrey_models::models::response::api_error::GeoffreyAPIError; use geoffrey_models::models::response::APIResponse; -use reqwest::Error; -use serde::de::DeserializeOwned; -use serde::Serialize; -use serenity::model::prelude::application_command::{ - ApplicationCommand, ApplicationCommandInteraction, -}; -use serenity::prelude::{Context, SerenityError}; -use std::fmt::{Display, Formatter}; + +use crate::context::GeoffreyContext; + +pub mod add_item; +pub mod add_location; +mod arg_parse; +pub mod find; +pub mod selling; #[derive(Debug)] pub enum CommandError { diff --git a/geoffrey_bot/src/commands/selling.rs b/geoffrey_bot/src/bot/commands/selling.rs similarity index 98% rename from geoffrey_bot/src/commands/selling.rs rename to geoffrey_bot/src/bot/commands/selling.rs index 3c07c0c..8051f3d 100644 --- a/geoffrey_bot/src/commands/selling.rs +++ b/geoffrey_bot/src/bot/commands/selling.rs @@ -1,15 +1,18 @@ -use crate::commands::bot_command::{BotCommand, CommandError}; +use std::fmt::Write; +use std::str::FromStr; + use async_trait::async_trait; -use geoffrey_models::models::parameters::selling_params::{ItemSort, Order, SellingParams}; -use geoffrey_models::models::response::selling_listing::SellingListing; use reqwest::Method; use serenity::client::Context; use serenity::model::interactions::application_command::{ ApplicationCommand, ApplicationCommandInteraction, ApplicationCommandOptionType, }; use serenity::model::prelude::application_command::ApplicationCommandInteractionDataOptionValue; -use std::fmt::Write; -use std::str::FromStr; + +use geoffrey_models::models::parameters::selling_params::{ItemSort, Order, SellingParams}; +use geoffrey_models::models::response::selling_listing::SellingListing; + +use crate::bot::commands::{BotCommand, CommandError}; pub struct SellingCommand; diff --git a/geoffrey_bot/src/commands/mod.rs b/geoffrey_bot/src/bot/mod.rs similarity index 68% rename from geoffrey_bot/src/commands/mod.rs rename to geoffrey_bot/src/bot/mod.rs index 01e5822..ac86e30 100644 --- a/geoffrey_bot/src/commands/mod.rs +++ b/geoffrey_bot/src/bot/mod.rs @@ -1,17 +1,14 @@ -pub mod add_item; -pub mod add_location; -pub mod bot_command; -pub mod find; -pub mod selling; - -use crate::commands::add_item::AddItemCommand; -use crate::commands::add_location::AddLocationCommand; -use crate::commands::bot_command::{BotCommand, CommandError}; -use crate::commands::find::FindCommand; -use crate::commands::selling::SellingCommand; use serenity::model::interactions::application_command::ApplicationCommand; use serenity::prelude::*; +use commands::{BotCommand, CommandError}; +use commands::add_item::AddItemCommand; +use commands::add_location::AddLocationCommand; +use commands::find::FindCommand; +use commands::selling::SellingCommand; + +pub mod commands; + pub async fn create_commands(ctx: &Context) -> Result, CommandError> { let mut commands: Vec = Vec::new(); diff --git a/geoffrey_bot/src/main.rs b/geoffrey_bot/src/main.rs index 58cb8d0..f45682b 100644 --- a/geoffrey_bot/src/main.rs +++ b/geoffrey_bot/src/main.rs @@ -1,13 +1,13 @@ -mod commands; +mod bot; mod configs; mod context; -use crate::commands::add_item::AddItemCommand; -use crate::commands::add_location::AddLocationCommand; -use crate::commands::bot_command::BotCommand; -use crate::commands::create_commands; -use crate::commands::find::FindCommand; -use crate::commands::selling::SellingCommand; +use bot::commands::add_item::AddItemCommand; +use bot::commands::add_location::AddLocationCommand; +use bot::commands::BotCommand; +use crate::bot::create_commands; +use bot::commands::find::FindCommand; +use bot::commands::selling::SellingCommand; use crate::configs::GeoffreyBotConfig; use crate::context::GeoffreyContext; use geoffrey_models::models::player::UserID; @@ -44,7 +44,7 @@ impl EventHandler for Handler { println!("{} is connected!", ready.user.name); let commands = create_commands(&ctx).await.unwrap(); - println!("The following commands have been registered:"); + println!("The following bot have been registered:"); for command in commands { println!(