Skip to content

Commit

Permalink
Set alias for tungstenite message
Browse files Browse the repository at this point in the history
  • Loading branch information
cesare committed Feb 27, 2021
1 parent 251a6f3 commit 7b8f62a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bin/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use anyhow::Result;
use futures::stream::{Stream, StreamExt};
use tokio::sync::mpsc::{channel, Sender};
use tokio_tungstenite::tungstenite::Error as WsError;
use tokio_tungstenite::tungstenite::Message;
use tokio_tungstenite::tungstenite::Message as WsMessage;

use slack_client::client::SlackApiClient;
use slack_client::events;
use slack_client::requests::RtmConnectRequest;
use slack_client::responses::RtmConnect;

async fn wait_for_messages(stream: &mut (dyn Stream<Item = Result<Message, WsError>> + Unpin + Send), tx: &mut Sender<events::Message>) {
async fn wait_for_messages(stream: &mut (dyn Stream<Item = Result<WsMessage, WsError>> + Unpin + Send), tx: &mut Sender<events::Message>) {
while let Some(Ok(message)) = stream.next().await {
if let Message::Text(text) = message {
if let WsMessage::Text(text) = message {
if let Ok(msg) = serde_json::from_str::<events::Message>(&text) {
let _ = tx.send(msg).await;
}
Expand Down

0 comments on commit 7b8f62a

Please sign in to comment.