Verified Commit 19afcaa3 authored by Mathias B.'s avatar Mathias B.
Browse files

Ajout de l'envoi de messages via le RPC

parent c011a201
use actix_web::{delete, get, HttpResponse, post, put, web};
use crate::rpc_server::DiscordClient;
use crate::rpc_server::utilities::ClientError;
use serenity::model::channel::ReactionType;
use serde::Deserialize;
pub struct SendMessageRequestBody {
content: String,
......@@ -21,8 +28,23 @@ pub async fn get_message(path_params: web::Path<(u64, u64)>) -> Result<HttpRespo
pub async fn send_message() -> HttpResponse {
todo!("Implémenter la méthode")
pub async fn send_message(path_params: web::Path<u64>, body: web::Json<SendMessageRequestBody>) -> Result<HttpResponse, ClientError> {
let channel_id = path_params.into_inner();
let client = DiscordClient::get();
let channel =
let message =, |builder| {
.map_err(|e| {
tracing::error!("Error from Discord: {:#?}", e);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment