send message

This commit is contained in:
Mylloon 2022-01-05 01:37:20 +01:00
parent 7ccb1e0dc7
commit b099674fef
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -189,31 +189,23 @@ async fn envoie_msg_mattermost(msg: Message) {
infos = recuperation_info(); infos = recuperation_info();
} }
let salon = infos.recuperation_salon(); let salon = infos.recuperation_salon();
println!("Envoie d'un message de {}!", msg.author);
let res = infos let res = infos
.recuperation_api() .recuperation_api()
.await .await
.query::<String>( .query::<String>(
"POST", "POST",
"post", "posts",
None, None,
Some( Some(
&json!( // d'après la documentation : https://api.mattermost.com/#tag/WebSocket &json!( // d'après la documentation : https://api.mattermost.com/#tag/WebSocket
{ {
"channel_id": salon, "channel_id": salon,
"message": msg "message": msg.content
} }
) )
.to_string(), .to_string(),
), ),
) )
.await; .await;
match res {
Ok(res) => {
println!("{}", res);
}
Err(e) => {
erreur::affiche_message_erreur(&format!("[Discord -> Mattermost] Erreur: {}", e));
}
}
} }