Checkpoint
This commit is contained in:
+16
-16
@@ -1,4 +1,6 @@
|
||||
use std::{fmt::Debug, sync::Arc, time::Duration};
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use thiserror::Error;
|
||||
@@ -8,22 +10,20 @@ use twilight_gateway::{ConfigBuilder, Event, EventTypeFlags, Intents, Shard, Sha
|
||||
use twilight_http::Client;
|
||||
use twilight_model::gateway::payload::outgoing::update_presence::UpdatePresencePayload;
|
||||
|
||||
use crate::{
|
||||
framework::{
|
||||
commands::{Command, extras::ExtrasGetter, runner::CommandRunner},
|
||||
events::traits::{
|
||||
OnInteractionHandler, OnMessageDeleteHandler, OnMessageEditHandler, OnMessageHandler,
|
||||
OnReadyHandler, OnReconnectHandler, OnServerCreateHandler, OnServerDeleteHandler,
|
||||
OnServerUpdateHandler,
|
||||
},
|
||||
interactions::{
|
||||
components::Component, registry::ComponentRegistry, runner::InteractionRunner,
|
||||
},
|
||||
runtime::Runtime,
|
||||
tasks::Task,
|
||||
},
|
||||
utils::Bye,
|
||||
use crate::framework::commands::Command;
|
||||
use crate::framework::commands::extras::ExtrasGetter;
|
||||
use crate::framework::commands::runner::CommandRunner;
|
||||
use crate::framework::events::traits::{
|
||||
OnInteractionHandler, OnMessageDeleteHandler, OnMessageEditHandler, OnMessageHandler,
|
||||
OnReadyHandler, OnReconnectHandler, OnServerCreateHandler, OnServerDeleteHandler,
|
||||
OnServerUpdateHandler,
|
||||
};
|
||||
use crate::framework::interactions::components::Component;
|
||||
use crate::framework::interactions::registry::ComponentRegistry;
|
||||
use crate::framework::interactions::runner::InteractionRunner;
|
||||
use crate::framework::runtime::Runtime;
|
||||
use crate::framework::tasks::Task;
|
||||
use crate::utils::Bye;
|
||||
|
||||
/// Errors occurred while attempting to run the bot.
|
||||
#[derive(Debug, Error)]
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
use std::{
|
||||
fmt,
|
||||
ops::{Deref, DerefMut},
|
||||
};
|
||||
use std::fmt;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{database::models::DatabaseError, framework::commands::context::CommandContext};
|
||||
use crate::database::models::DatabaseError;
|
||||
use crate::framework::commands::context::CommandContext;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ArgumentParsingError {
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use twilight_http::{Error, Response};
|
||||
use twilight_model::{
|
||||
channel::{Message, message::Component},
|
||||
gateway::payload::incoming::MessageCreate,
|
||||
};
|
||||
use twilight_model::channel::Message;
|
||||
use twilight_model::channel::message::Component;
|
||||
use twilight_model::gateway::payload::incoming::MessageCreate;
|
||||
|
||||
use crate::framework::{
|
||||
commands::messages::MessageSender, interactions::components::ActionRow,
|
||||
messages::MessageBuilder, runtime::Runtime,
|
||||
};
|
||||
use crate::framework::commands::messages::MessageSender;
|
||||
use crate::framework::interactions::components::ActionRow;
|
||||
use crate::framework::messages::MessageBuilder;
|
||||
use crate::framework::runtime::Runtime;
|
||||
|
||||
pub struct CommandContext<'a, T, E> {
|
||||
pub event: &'a MessageCreate,
|
||||
|
||||
@@ -1,27 +1,18 @@
|
||||
use std::{
|
||||
future::{Future, IntoFuture},
|
||||
pin::Pin,
|
||||
sync::Arc,
|
||||
};
|
||||
use std::future::{Future, IntoFuture};
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
|
||||
use twilight_http::{Error, Response, response::marker::EmptyBody};
|
||||
use twilight_model::{
|
||||
channel::{
|
||||
Message,
|
||||
message::{Component as TwilightComponent, Embed},
|
||||
},
|
||||
http::interaction::{InteractionResponse, InteractionResponseType},
|
||||
id::{
|
||||
Id,
|
||||
marker::{ChannelMarker, InteractionMarker},
|
||||
},
|
||||
};
|
||||
use twilight_http::response::marker::EmptyBody;
|
||||
use twilight_http::{Error, Response};
|
||||
use twilight_model::channel::Message;
|
||||
use twilight_model::channel::message::{Component as TwilightComponent, Embed};
|
||||
use twilight_model::http::interaction::{InteractionResponse, InteractionResponseType};
|
||||
use twilight_model::id::Id;
|
||||
use twilight_model::id::marker::{ChannelMarker, InteractionMarker};
|
||||
use twilight_util::builder::InteractionResponseDataBuilder;
|
||||
|
||||
use crate::framework::{
|
||||
interactions::components::{ActionRow, Component},
|
||||
runtime::Runtime,
|
||||
};
|
||||
use crate::framework::interactions::components::{ActionRow, Component};
|
||||
use crate::framework::runtime::Runtime;
|
||||
|
||||
pub struct MessageSender<T, E> {
|
||||
channel_id: Id<ChannelMarker>,
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use deadpool_redis::{cluster::PoolError, redis::RedisError};
|
||||
use deadpool_redis::cluster::PoolError;
|
||||
use deadpool_redis::redis::RedisError;
|
||||
use thiserror::Error;
|
||||
use twilight_http::response::DeserializeBodyError;
|
||||
|
||||
use crate::{
|
||||
database::models::{DatabaseError, DatabaseOrDiscordError},
|
||||
framework::{
|
||||
commands::{arguments::Argument, context::CommandContext, permissions::Permission},
|
||||
runtime::Runtime,
|
||||
},
|
||||
};
|
||||
use crate::database::models::{DatabaseError, DatabaseOrDiscordError};
|
||||
use crate::framework::commands::arguments::Argument;
|
||||
use crate::framework::commands::context::CommandContext;
|
||||
use crate::framework::commands::permissions::Permission;
|
||||
use crate::framework::runtime::Runtime;
|
||||
|
||||
pub mod arguments;
|
||||
pub mod context;
|
||||
|
||||
@@ -2,7 +2,8 @@ use std::fmt::Debug;
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::framework::commands::{CommandError, context::CommandContext};
|
||||
use crate::framework::commands::CommandError;
|
||||
use crate::framework::commands::context::CommandContext;
|
||||
|
||||
#[async_trait]
|
||||
pub trait Permission<S: Send + Sync + 'static, E>: Debug {
|
||||
|
||||
@@ -3,11 +3,11 @@ use std::sync::Arc;
|
||||
use async_trait::async_trait;
|
||||
use twilight_model::gateway::payload::incoming::MessageCreate;
|
||||
|
||||
use crate::framework::{
|
||||
commands::{context::CommandContext, extras::ExtrasGetter, get_command_parts},
|
||||
events::traits::{EventResult, OnMessageHandler},
|
||||
runtime::Runtime,
|
||||
};
|
||||
use crate::framework::commands::context::CommandContext;
|
||||
use crate::framework::commands::extras::ExtrasGetter;
|
||||
use crate::framework::commands::get_command_parts;
|
||||
use crate::framework::events::traits::{EventResult, OnMessageHandler};
|
||||
use crate::framework::runtime::Runtime;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CommandRunner;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use std::{error::Error, fmt::Debug, sync::Arc};
|
||||
use std::error::Error;
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use twilight_model::gateway::payload::incoming::{
|
||||
@@ -6,7 +8,8 @@ use twilight_model::gateway::payload::incoming::{
|
||||
MessageUpdate, Ready,
|
||||
};
|
||||
|
||||
use crate::framework::{commands::extras::ExtrasGetter, runtime::Runtime};
|
||||
use crate::framework::commands::extras::ExtrasGetter;
|
||||
use crate::framework::runtime::Runtime;
|
||||
|
||||
pub type EventResult = Result<(), Box<dyn Error>>;
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use twilight_model::channel::message::{
|
||||
Component as TwilightComponent,
|
||||
component::{ActionRow as TwilightActionRow, Button as TwilightButton, ButtonStyle},
|
||||
use twilight_model::channel::message::Component as TwilightComponent;
|
||||
use twilight_model::channel::message::component::{
|
||||
ActionRow as TwilightActionRow, Button as TwilightButton, ButtonStyle,
|
||||
};
|
||||
|
||||
use crate::framework::interactions::{InteractionError, context::InteractionContext};
|
||||
use crate::framework::interactions::InteractionError;
|
||||
use crate::framework::interactions::context::InteractionContext;
|
||||
|
||||
type ComponentWithID<T, E> = (Option<String>, Arc<dyn Component<T, E>>);
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use twilight_http::{Error, Response, response::marker::EmptyBody};
|
||||
use twilight_model::{
|
||||
gateway::payload::incoming::InteractionCreate,
|
||||
http::interaction::{InteractionResponse, InteractionResponseType},
|
||||
};
|
||||
use twilight_http::response::marker::EmptyBody;
|
||||
use twilight_http::{Error, Response};
|
||||
use twilight_model::gateway::payload::incoming::InteractionCreate;
|
||||
use twilight_model::http::interaction::{InteractionResponse, InteractionResponseType};
|
||||
use twilight_util::builder::InteractionResponseDataBuilder;
|
||||
|
||||
use crate::framework::{
|
||||
interactions::{InteractionError, components::ActionRow},
|
||||
messages::MessageEditBuilder,
|
||||
runtime::Runtime,
|
||||
};
|
||||
use crate::framework::interactions::InteractionError;
|
||||
use crate::framework::interactions::components::ActionRow;
|
||||
use crate::framework::messages::MessageEditBuilder;
|
||||
use crate::framework::runtime::Runtime;
|
||||
|
||||
pub struct InteractionContext<T, E> {
|
||||
pub event: InteractionCreate,
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use scc::HashMap;
|
||||
|
||||
use twilight_model::{
|
||||
application::interaction::InteractionData, gateway::payload::incoming::InteractionCreate,
|
||||
};
|
||||
|
||||
use crate::framework::{
|
||||
commands::extras::ExtrasGetter,
|
||||
interactions::{InteractionError, context::InteractionContext},
|
||||
runtime::Runtime,
|
||||
};
|
||||
use twilight_model::application::interaction::InteractionData;
|
||||
use twilight_model::gateway::payload::incoming::InteractionCreate;
|
||||
|
||||
use super::components::Component;
|
||||
use crate::framework::commands::extras::ExtrasGetter;
|
||||
use crate::framework::interactions::InteractionError;
|
||||
use crate::framework::interactions::context::InteractionContext;
|
||||
use crate::framework::runtime::Runtime;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct ComponentRegistry<T, E> {
|
||||
|
||||
@@ -3,11 +3,9 @@ use std::sync::Arc;
|
||||
use async_trait::async_trait;
|
||||
use twilight_model::gateway::payload::incoming::InteractionCreate;
|
||||
|
||||
use crate::framework::{
|
||||
commands::extras::ExtrasGetter,
|
||||
events::traits::{EventResult, OnInteractionHandler},
|
||||
runtime::Runtime,
|
||||
};
|
||||
use crate::framework::commands::extras::ExtrasGetter;
|
||||
use crate::framework::events::traits::{EventResult, OnInteractionHandler};
|
||||
use crate::framework::runtime::Runtime;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct InteractionRunner;
|
||||
|
||||
@@ -22,11 +22,12 @@ use std::sync::Arc;
|
||||
use tokio::sync::mpsc::UnboundedSender;
|
||||
use twilight_cache_inmemory::InMemoryCache;
|
||||
use twilight_http::Client;
|
||||
use twilight_model::{gateway::payload::outgoing::UpdatePresence, oauth::Application};
|
||||
use twilight_model::gateway::payload::outgoing::UpdatePresence;
|
||||
use twilight_model::oauth::Application;
|
||||
|
||||
use crate::framework::{
|
||||
bot::PrefixGetter, commands::Command, interactions::registry::ComponentRegistry,
|
||||
};
|
||||
use crate::framework::bot::PrefixGetter;
|
||||
use crate::framework::commands::Command;
|
||||
use crate::framework::interactions::registry::ComponentRegistry;
|
||||
|
||||
/// The application's runtime tools.
|
||||
pub struct Runtime<T, E> {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use std::{fmt::Debug, time::Duration};
|
||||
use std::fmt::Debug;
|
||||
use std::time::Duration;
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user