From a727c4a8748c88609a579ca246e18712117573a2 Mon Sep 17 00:00:00 2001 From: Daniel Cadenas Date: Thu, 25 Jul 2024 13:11:22 -0300 Subject: [PATCH] Use string for config friendliness --- src/adapters/slack_client_adapter.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/adapters/slack_client_adapter.rs b/src/adapters/slack_client_adapter.rs index 3c21736..1e6de87 100644 --- a/src/adapters/slack_client_adapter.rs +++ b/src/adapters/slack_client_adapter.rs @@ -1,20 +1,20 @@ use crate::actors::messages::SupervisorMessage; use crate::actors::{SlackClientPort, SlackClientPortBuilder}; -use crate::config::Configurable; use crate::adapters::njump_or_pubkey; +use crate::config::Configurable; use crate::domain_objects::ReportRequest; use anyhow::Result; use hyper_rustls::HttpsConnector; use hyper_util::client::legacy::connect::HttpConnector; use nostr_sdk::nips::nip56::Report; use ractor::ActorRef; -use slack_morphism::prelude::*; use serde::Deserialize; +use slack_morphism::prelude::*; use tracing::info; #[derive(Debug, Clone, Deserialize)] pub struct Config { - pub token: SlackApiToken, + pub token: String, pub channel_id: SlackChannelId, } @@ -51,7 +51,8 @@ impl SlackClientPortBuilder for SlackClientAdapterBuilder { impl SlackClientAdapter { async fn post_message(&self, message: SlackApiChatPostMessageRequest) { - let session = self.client.open_session(&self.config.token); + let token = SlackApiToken::new(self.config.token.clone().into()); + let session = self.client.open_session(&token); let post_chat_resp = session.chat_post_message(&message).await; info!("post chat resp: {:#?}", &post_chat_resp);