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 commands = Commands::<euphoxide::Error>::new()
|
||||
.then(Ping::default().general("ping").hidden())
|
||||
.then(Ping::default().specific("ping").hidden())
|
||||
.then(Ping::default().general("ping").with_info_hidden())
|
||||
.then(Ping::default().specific("ping").with_info_hidden())
|
||||
.then(
|
||||
ShortHelp::new("/me demonstrates how to use euphoxide")
|
||||
.general("help")
|
||||
.hidden(),
|
||||
.with_info_hidden(),
|
||||
)
|
||||
.then(
|
||||
FullHelp::new()
|
||||
.with_after("Created using euphoxide.")
|
||||
.specific("help")
|
||||
.hidden(),
|
||||
.with_info_hidden(),
|
||||
)
|
||||
.then(
|
||||
FromHandler::new(pyramid)
|
||||
.described()
|
||||
.with_info()
|
||||
.with_description("build a pyramid")
|
||||
.general("pyramid"),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use std::{future::Future, sync::Arc};
|
|||
|
||||
use async_trait::async_trait;
|
||||
use bang::{General, Global, Specific};
|
||||
use basic::{Described, Prefixed};
|
||||
use basic::{Prefixed, WithInfo};
|
||||
use euphoxide::{
|
||||
api::{self, Data, Message, MessageId, SendEvent, SendReply},
|
||||
client::{
|
||||
|
|
@ -121,12 +121,12 @@ pub trait Command<E = euphoxide::Error> {
|
|||
}
|
||||
|
||||
pub trait CommandExt: Sized {
|
||||
fn described(self) -> Described<Self> {
|
||||
Described::new(self)
|
||||
fn with_info(self) -> WithInfo<Self> {
|
||||
WithInfo::new(self)
|
||||
}
|
||||
|
||||
fn hidden(self) -> Described<Self> {
|
||||
Described::hidden(self)
|
||||
fn with_info_hidden(self) -> WithInfo<Self> {
|
||||
WithInfo::hidden(self)
|
||||
}
|
||||
|
||||
fn prefixed(self, prefix: impl ToString) -> Prefixed<Self> {
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ use euphoxide::api::Message;
|
|||
use super::{Command, Context, Info, Propagate};
|
||||
|
||||
/// Rewrite or hide command info.
|
||||
pub struct Described<C> {
|
||||
pub struct WithInfo<C> {
|
||||
pub inner: C,
|
||||
pub trigger: Option<Option<String>>,
|
||||
pub description: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl<C> Described<C> {
|
||||
impl<C> WithInfo<C> {
|
||||
pub fn new(inner: C) -> Self {
|
||||
Self {
|
||||
inner,
|
||||
|
|
@ -51,7 +51,7 @@ impl<C> Described<C> {
|
|||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<E, C> Command<E> for Described<C>
|
||||
impl<E, C> Command<E> for WithInfo<C>
|
||||
where
|
||||
C: Command<E> + Sync,
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue