pub struct DiscordChannel { /* private fields */ }Expand description
Discord channel — connects via Gateway WebSocket for real-time messages
Implementations§
Source§impl DiscordChannel
impl DiscordChannel
pub fn new( bot_token: String, guild_ids: Vec<String>, alias: impl Into<String>, peer_resolver: Arc<dyn Fn() -> Vec<String> + Send + Sync>, listen_to_bots: bool, mention_only: bool, ) -> Self
Sourcepub fn with_proxy_url(self, proxy_url: Option<String>) -> Self
pub fn with_proxy_url(self, proxy_url: Option<String>) -> Self
Set a per-channel proxy URL that overrides the global proxy config.
pub fn with_approval_timeout_secs(self, secs: u64) -> Self
Sourcepub fn with_workspace_dir(self, dir: PathBuf) -> Self
pub fn with_workspace_dir(self, dir: PathBuf) -> Self
Configure workspace directory for saving downloaded attachments.
Sourcepub fn with_transcription(self, config: TranscriptionConfig) -> Self
pub fn with_transcription(self, config: TranscriptionConfig) -> Self
Configure voice transcription for audio attachments.
Sourcepub fn with_streaming(
self,
stream_mode: StreamMode,
draft_update_interval_ms: u64,
multi_message_delay_ms: u64,
) -> Self
pub fn with_streaming( self, stream_mode: StreamMode, draft_update_interval_ms: u64, multi_message_delay_ms: u64, ) -> Self
Configure streaming mode for progressive draft updates or multi-message delivery.
Sourcepub fn with_stall_timeout(self, secs: u64) -> Self
pub fn with_stall_timeout(self, secs: u64) -> Self
Set the stall-watchdog timeout (0 = disabled).
pub fn with_channel_ids(self, ids: Vec<String>) -> Self
pub fn with_archive_memory(self, mem: Arc<dyn Memory>) -> Self
Trait Implementations§
Source§impl Attributable for DiscordChannel
impl Attributable for DiscordChannel
Source§impl Channel for DiscordChannel
impl Channel for DiscordChannel
Source§fn self_handle(&self) -> Option<String>
fn self_handle(&self) -> Option<String>
Discord bot tokens encode the bot’s user ID in the first
segment (base64(user_id).timestamp.hmac); decode on demand
rather than caching since the result is deterministic and the
orchestrator only calls self_handle on the inbound path.
Returning the user ID engages the SDK self-loop guard against
gateway events the bot itself produced (typing indicators,
echoed message events from intent overlap, etc.).
Source§fn self_addressed_mention(&self) -> Option<String>
fn self_addressed_mention(&self) -> Option<String>
Discord renders user mentions as <@SNOWFLAKE> (or
<@!SNOWFLAKE> with the legacy nickname prefix, which the API
normalizes to the bare form on inbound). Returns the bot’s
snowflake wrapped in that exact form so the agent matches its
own mention without parsing the angle brackets itself.
Source§fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 SendMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 SendMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn listen<'life0, 'async_trait>(
&'life0 self,
tx: Sender<ChannelMessage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn listen<'life0, 'async_trait>(
&'life0 self,
tx: Sender<ChannelMessage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn start_typing<'life0, 'life1, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start_typing<'life0, 'life1, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn stop_typing<'life0, 'life1, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop_typing<'life0, 'life1, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn supports_draft_updates(&self) -> bool
fn supports_draft_updates(&self) -> bool
Source§fn supports_multi_message_streaming(&self) -> bool
fn supports_multi_message_streaming(&self) -> bool
Source§fn multi_message_delay_ms(&self) -> u64
fn multi_message_delay_ms(&self) -> u64
Source§fn send_draft<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 SendMessage,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_draft<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 SendMessage,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn update_draft<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_id: &'life2 str,
text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn update_draft<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_id: &'life2 str,
text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn finalize_draft<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_id: &'life2 str,
text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn finalize_draft<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_id: &'life2 str,
text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn cancel_draft<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn cancel_draft<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
message_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn add_reaction<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel_id: &'life1 str,
message_id: &'life2 str,
emoji: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn add_reaction<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel_id: &'life1 str,
message_id: &'life2 str,
emoji: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn remove_reaction<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel_id: &'life1 str,
message_id: &'life2 str,
emoji: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn remove_reaction<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel_id: &'life1 str,
message_id: &'life2 str,
emoji: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn request_approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
request: &'life2 ChannelApprovalRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<ChannelApprovalResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn request_approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
recipient: &'life1 str,
request: &'life2 ChannelApprovalRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<ChannelApprovalResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn drop_self_messages(&self, msg: &ChannelMessage) -> bool
fn drop_self_messages(&self, msg: &ChannelMessage) -> bool
Source§fn update_draft_progress<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_recipient: &'life1 str,
_message_id: &'life2 str,
_text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn update_draft_progress<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_recipient: &'life1 str,
_message_id: &'life2 str,
_text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Source§fn pin_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_channel_id: &'life1 str,
_message_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn pin_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_channel_id: &'life1 str,
_message_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Source§fn unpin_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_channel_id: &'life1 str,
_message_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn unpin_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_channel_id: &'life1 str,
_message_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Source§fn redact_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_channel_id: &'life1 str,
_message_id: &'life2 str,
_reason: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn redact_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_channel_id: &'life1 str,
_message_id: &'life2 str,
_reason: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Source§fn request_choice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_question: &'life1 str,
_choices: &'life2 [String],
_timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn request_choice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_question: &'life1 str,
_choices: &'life2 [String],
_timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Source§fn supports_free_form_ask(&self) -> bool
fn supports_free_form_ask(&self) -> bool
ask_user
questions via the standard send + listen flow. Read moreAuto Trait Implementations§
impl !Freeze for DiscordChannel
impl !RefUnwindSafe for DiscordChannel
impl Send for DiscordChannel
impl Sync for DiscordChannel
impl Unpin for DiscordChannel
impl UnsafeUnpin for DiscordChannel
impl !UnwindSafe for DiscordChannel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more