Add support for extras, conditionally displaying commands in the help command, and start working on moderation commands

This commit is contained in:
2025-08-22 18:06:52 -03:00
parent 55ae1c8937
commit 8868b18be3
41 changed files with 1075 additions and 368 deletions
+18 -14
View File
@@ -23,23 +23,24 @@ use crate::framework::{
runtime::Runtime,
};
pub struct MessageSender<T> {
pub struct MessageSender<T, E> {
channel_id: Id<ChannelMarker>,
rt: Arc<Runtime<T>>,
rt: Arc<Runtime<T, E>>,
content: Option<String>,
embeds: Vec<Embed>,
// Row index, component
components: Vec<(u8, Arc<dyn Component<T>>)>,
components: Vec<(u8, Arc<dyn Component<T, E>>)>,
}
impl<T> MessageSender<T>
impl<T, E> MessageSender<T, E>
where
T: Send + Sync + 'static,
E: Send + Sync + 'static,
{
pub fn new(channel_id: Id<ChannelMarker>, rt: Arc<Runtime<T>>) -> Self {
pub fn new(channel_id: Id<ChannelMarker>, rt: Arc<Runtime<T, E>>) -> Self {
Self {
channel_id,
rt,
@@ -61,7 +62,7 @@ where
self
}
pub fn component(mut self, component: impl Component<T> + 'static, row: u8) -> Self {
pub fn component(mut self, component: impl Component<T, E> + 'static, row: u8) -> Self {
self.components.push((row, Arc::new(component)));
self
@@ -120,7 +121,7 @@ where
}
}
impl<T: Send + Sync + 'static> IntoFuture for MessageSender<T> {
impl<T: Send + Sync + 'static, E: Send + Sync + 'static> IntoFuture for MessageSender<T, E> {
type Output = Result<Response<Message>, Error>;
type IntoFuture = Pin<Box<dyn Future<Output = Self::Output> + Send>>;
@@ -129,27 +130,28 @@ impl<T: Send + Sync + 'static> IntoFuture for MessageSender<T> {
}
}
pub struct OriginalMessageUpdater<T> {
pub struct OriginalMessageUpdater<T, E> {
interaction_id: Id<InteractionMarker>,
interaction_token: String,
rt: Arc<Runtime<T>>,
rt: Arc<Runtime<T, E>>,
content: Option<String>,
embeds: Vec<Embed>,
// Row index, component
components: Vec<(u8, Arc<dyn Component<T>>)>,
components: Vec<(u8, Arc<dyn Component<T, E>>)>,
}
impl<T> OriginalMessageUpdater<T>
impl<T, E> OriginalMessageUpdater<T, E>
where
T: Send + Sync + 'static,
E: Send + Sync + 'static,
{
pub fn new(
interaction_id: Id<InteractionMarker>,
interaction_token: String,
rt: Arc<Runtime<T>>,
rt: Arc<Runtime<T, E>>,
) -> Self {
Self {
interaction_id,
@@ -174,7 +176,7 @@ where
self
}
pub fn component(mut self, component: impl Component<T> + 'static, row: u8) -> Self {
pub fn component(mut self, component: impl Component<T, E> + 'static, row: u8) -> Self {
self.components.push((row, Arc::new(component)));
self
@@ -245,7 +247,9 @@ where
}
}
impl<T: Send + Sync + 'static> IntoFuture for OriginalMessageUpdater<T> {
impl<T: Send + Sync + 'static, E: Send + Sync + 'static> IntoFuture
for OriginalMessageUpdater<T, E>
{
type Output = Result<Response<EmptyBody>, Error>;
type IntoFuture = Pin<Box<dyn Future<Output = Self::Output> + Send>>;