Rename Described to WithInfo
This commit is contained in:
parent
3571a97fb2
commit
c2eeacac52
3 changed files with 13 additions and 13 deletions
|
|
@ -29,22 +29,22 @@ async fn main() {
|
||||||
let (event_tx, mut event_rx) = mpsc::channel(10);
|
let (event_tx, mut event_rx) = mpsc::channel(10);
|
||||||
|
|
||||||
let commands = Commands::<euphoxide::Error>::new()
|
let commands = Commands::<euphoxide::Error>::new()
|
||||||
.then(Ping::default().general("ping").hidden())
|
.then(Ping::default().general("ping").with_info_hidden())
|
||||||
.then(Ping::default().specific("ping").hidden())
|
.then(Ping::default().specific("ping").with_info_hidden())
|
||||||
.then(
|
.then(
|
||||||
ShortHelp::new("/me demonstrates how to use euphoxide")
|
ShortHelp::new("/me demonstrates how to use euphoxide")
|
||||||
.general("help")
|
.general("help")
|
||||||
.hidden(),
|
.with_info_hidden(),
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
FullHelp::new()
|
FullHelp::new()
|
||||||
.with_after("Created using euphoxide.")
|
.with_after("Created using euphoxide.")
|
||||||
.specific("help")
|
.specific("help")
|
||||||
.hidden(),
|
.with_info_hidden(),
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
FromHandler::new(pyramid)
|
FromHandler::new(pyramid)
|
||||||
.described()
|
.with_info()
|
||||||
.with_description("build a pyramid")
|
.with_description("build a pyramid")
|
||||||
.general("pyramid"),
|
.general("pyramid"),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use std::{future::Future, sync::Arc};
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use bang::{General, Global, Specific};
|
use bang::{General, Global, Specific};
|
||||||
use basic::{Described, Prefixed};
|
use basic::{Prefixed, WithInfo};
|
||||||
use euphoxide::{
|
use euphoxide::{
|
||||||
api::{self, Data, Message, MessageId, SendEvent, SendReply},
|
api::{self, Data, Message, MessageId, SendEvent, SendReply},
|
||||||
client::{
|
client::{
|
||||||
|
|
@ -121,12 +121,12 @@ pub trait Command<E = euphoxide::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait CommandExt: Sized {
|
pub trait CommandExt: Sized {
|
||||||
fn described(self) -> Described<Self> {
|
fn with_info(self) -> WithInfo<Self> {
|
||||||
Described::new(self)
|
WithInfo::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hidden(self) -> Described<Self> {
|
fn with_info_hidden(self) -> WithInfo<Self> {
|
||||||
Described::hidden(self)
|
WithInfo::hidden(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prefixed(self, prefix: impl ToString) -> Prefixed<Self> {
|
fn prefixed(self, prefix: impl ToString) -> Prefixed<Self> {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ use euphoxide::api::Message;
|
||||||
use super::{Command, Context, Info, Propagate};
|
use super::{Command, Context, Info, Propagate};
|
||||||
|
|
||||||
/// Rewrite or hide command info.
|
/// Rewrite or hide command info.
|
||||||
pub struct Described<C> {
|
pub struct WithInfo<C> {
|
||||||
pub inner: C,
|
pub inner: C,
|
||||||
pub trigger: Option<Option<String>>,
|
pub trigger: Option<Option<String>>,
|
||||||
pub description: Option<Option<String>>,
|
pub description: Option<Option<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C> Described<C> {
|
impl<C> WithInfo<C> {
|
||||||
pub fn new(inner: C) -> Self {
|
pub fn new(inner: C) -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner,
|
inner,
|
||||||
|
|
@ -51,7 +51,7 @@ impl<C> Described<C> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<E, C> Command<E> for Described<C>
|
impl<E, C> Command<E> for WithInfo<C>
|
||||||
where
|
where
|
||||||
C: Command<E> + Sync,
|
C: Command<E> + Sync,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue