diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-05-02 15:55:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-02 15:55:58 -0500 |
| commit | 9a40b65bc1912298a43de43fd6e8477a8622a832 (patch) | |
| tree | c429c62489926d6bbfc1675fea5a1860378d7a00 /azalea/examples | |
| parent | 52e34de95cd64a1c8ae1177cd7bc1d67fbab3c71 (diff) | |
| download | azalea-drasl-9a40b65bc1912298a43de43fd6e8477a8622a832.tar.xz | |
Add AutoReconnectPlugin (#221)
* add AutoReconnectPlugin
* merge main
* start simplifying swarm internals
* fix Swarm::into_iter, handler functions, DisconnectEvent, and add some more docs
* add ClientBuilder/SwarmBuilder::reconnect_after
* fix a doctest
* reword SwarmEvent::Disconnect doc
* better behavior when we try to join twice
* reconnect on ConnectionFailedEvent too
* autoreconnect is less breaking now
Diffstat (limited to 'azalea/examples')
| -rw-r--r-- | azalea/examples/testbot/main.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/azalea/examples/testbot/main.rs b/azalea/examples/testbot/main.rs index c25904cf..6733d797 100644 --- a/azalea/examples/testbot/main.rs +++ b/azalea/examples/testbot/main.rs @@ -192,14 +192,10 @@ async fn handle(bot: Client, event: azalea::Event, state: State) -> anyhow::Resu Ok(()) } -async fn swarm_handle(swarm: Swarm, event: SwarmEvent, _state: SwarmState) -> anyhow::Result<()> { +async fn swarm_handle(_swarm: Swarm, event: SwarmEvent, _state: SwarmState) -> anyhow::Result<()> { match &event { - SwarmEvent::Disconnect(account, join_opts) => { + SwarmEvent::Disconnect(account, _join_opts) => { println!("bot got kicked! {}", account.username); - tokio::time::sleep(Duration::from_secs(5)).await; - swarm - .add_and_retry_forever_with_opts(account, State::default(), join_opts) - .await; } SwarmEvent::Chat(chat) => { if chat.message().to_string() == "The particle was not visible for anybody" { |
