pub struct BotBuilder { /* private fields */ }websocket only.Implementations§
Source§impl BotBuilder
impl BotBuilder
pub fn new(name: impl Into<String>, port: u16) -> Self
Sourcepub fn db_prefix(self, prefix: impl Into<String>) -> Self
Available on crate feature cli only.
pub fn db_prefix(self, prefix: impl Into<String>) -> Self
cli only.Path prefix for the SimpleX database
“{dir}/{prefix}” creates a {dir} with {prefix}_agent.db and {prefix}_chat.db;
“{prefix}” creates {prefix}_agent.db and {prefix}_chat.db at the current dir
Sourcepub fn db_key(self, key: impl Into<String>) -> Self
Available on crate feature cli only.
pub fn db_key(self, key: impl Into<String>) -> Self
cli only.Database encryption key.
Sourcepub fn connect_retry_delay(self, delay: Duration) -> Self
pub fn connect_retry_delay(self, delay: Duration) -> Self
Delay between connection retry attempt. Default: 1s
Sourcepub fn auto_accept(self) -> Self
pub fn auto_accept(self) -> Self
Create public address and auto accept users
Sourcepub fn auto_accept_with(self, welcome_message: impl Into<String>) -> Self
pub fn auto_accept_with(self, welcome_message: impl Into<String>) -> Self
Set a welcome message. This automatically creates a public address with enabled auto_accept
Sourcepub fn with_avatar(self, avatar: ImagePreview) -> Self
pub fn with_avatar(self, avatar: ImagePreview) -> Self
Set the bot avatar during initialisation
Sourcepub fn with_profile(self, profile: Profile) -> Self
pub fn with_profile(self, profile: Profile) -> Self
Update/create the whole bot profile on launch
Sourcepub fn with_preferences(self, prefs: Preferences) -> Self
pub fn with_preferences(self, prefs: Preferences) -> Self
Apply these preferences to the bot’s profile during initialisation.
Sourcepub fn cli_args<I, S>(self, args: I) -> Self
Available on crate feature cli only.
pub fn cli_args<I, S>(self, args: I) -> Self
cli only.Pass extra arguments to the simplex-chat process.
Sourcepub async fn connect(self) -> Result<(Bot, EventStream), BotInitError>
pub async fn connect(self) -> Result<(Bot, EventStream), BotInitError>
Connect to an already-running simplex-chat instance.
Sourcepub async fn launch(
self,
) -> Result<(Bot, EventStream, SimplexCli), BotInitError>
Available on crate feature cli only.
pub async fn launch( self, ) -> Result<(Bot, EventStream, SimplexCli), BotInitError>
cli only.Spawn simplex-chat, then connect and initialise.
Returns (bot, events, cli). The caller is responsible for calling
cli::SimplexCli::kill after the bot finishes.
Auto Trait Implementations§
impl Freeze for BotBuilder
impl RefUnwindSafe for BotBuilder
impl Send for BotBuilder
impl Sync for BotBuilder
impl Unpin for BotBuilder
impl UnsafeUnpin for BotBuilder
impl UnwindSafe for BotBuilder
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
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