From 1ac723d6d51b437c2d9691537349d29a27f13dee Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 5 Jan 2022 01:24:17 +0100 Subject: [PATCH] make retrieve of salon in mattermost file --- src/discord.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/discord.rs b/src/discord.rs index dac7d75..dea7dd6 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -182,24 +182,13 @@ pub async fn start_discord( } } -/// Ne peut pas être async (limitation de serde_json) -fn recuperation_salon() -> String { - let infos: &InformationsBot; - unsafe { - infos = recuperation_info(); - } - - infos.recuperation_salon(); - - String::from("temp") -} - /// Envoie un message sur Mattermost async fn envoie_msg_mattermost(msg: Message) { let infos: &InformationsBot; unsafe { infos = recuperation_info(); } + let salon = infos.recuperation_salon(); let res = infos .recuperation_api() .await @@ -210,7 +199,7 @@ async fn envoie_msg_mattermost(msg: Message) { Some( &json!( // d'après la documentation : https://api.mattermost.com/#tag/WebSocket { - "channel_id": recuperation_salon(), + "channel_id": salon, "message": msg } )