pub struct BotBuilder { /* private fields */ }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
pub fn db_prefix(self, prefix: impl Into<String>) -> Self
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 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 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>
pub async fn launch( self, ) -> Result<(Bot, EventStream, SimplexCli), BotInitError>
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
Mutably borrows from an owned value. Read more