23 lines
516 B
Rust
23 lines
516 B
Rust
|
use poise::CreateReply;
|
||
|
use serenity::async_trait;
|
||
|
|
||
|
use crate::types::Context;
|
||
|
|
||
|
|
||
|
/// Trait to extend `Context` with additional methods.
|
||
|
#[async_trait]
|
||
|
pub trait ContextExt {
|
||
|
async fn reply_ephemeral(&self, content: &str) -> anyhow::Result<()>;
|
||
|
}
|
||
|
|
||
|
#[async_trait]
|
||
|
impl ContextExt for Context<'_> {
|
||
|
async fn reply_ephemeral(&self, content: &str) -> anyhow::Result<()> {
|
||
|
self.send(CreateReply::default()
|
||
|
.ephemeral(true)
|
||
|
.content(content)
|
||
|
).await?;
|
||
|
Ok(())
|
||
|
}
|
||
|
}
|