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