send message
This commit is contained in:
parent
7ccb1e0dc7
commit
b099674fef
1 changed files with 3 additions and 11 deletions
|
@ -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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue