Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ s3 = { version = "0.1.27", optional = true, features = ["providers"] }
schemars = { package = "apistos-schemars", version = "0.8.22", default-features = false }
serde = { version = "1.0.228", default-features = false }
serde_json = { version = "1.0.149", default-features = false }
tokio = "1.52.0"
tokio = "1.52.1"
tracing = { version = "0.1.44", default-features = false }
tracing-actix-web = { version = "0.7.21", default-features = false, features = [
"emit_event_on_error",
Expand Down
12 changes: 6 additions & 6 deletions src/api/routes/webhooks/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ async fn handle_botlistme(
) -> ApiResult<ProviderResponse> {
let webhook_config = bot
.webhooks_config
.webhooks
.providers
.get("botlistme")
.ok_or_else(|| {
ApiError::WebhookError(
Expand Down Expand Up @@ -181,7 +181,7 @@ async fn handle_dblist(
bot: &Bot,
authorization: Option<&str>,
) -> ApiResult<ProviderResponse> {
let webhook_config = bot.webhooks_config.webhooks.get("dblist").ok_or_else(|| {
let webhook_config = bot.webhooks_config.providers.get("dblist").ok_or_else(|| {
ApiError::WebhookError("Bot does not have webhook configured for dblist".to_string())
})?;

Expand Down Expand Up @@ -215,7 +215,7 @@ async fn handle_dblist(
async fn handle_discordlist(body_bytes: &[u8], bot: &Bot) -> ApiResult<ProviderResponse> {
let webhook_config = bot
.webhooks_config
.webhooks
.providers
.get("discordlist")
.ok_or_else(|| {
ApiError::WebhookError(
Expand Down Expand Up @@ -252,7 +252,7 @@ async fn handle_discordplace(
) -> ApiResult<ProviderResponse> {
let webhook_config = bot
.webhooks_config
.webhooks
.providers
.get("discordplace")
.ok_or_else(|| {
ApiError::WebhookError(
Expand Down Expand Up @@ -295,7 +295,7 @@ async fn handle_discordscom(
) -> ApiResult<ProviderResponse> {
let webhook_config = bot
.webhooks_config
.webhooks
.providers
.get("discordscom")
.ok_or_else(|| {
ApiError::WebhookError(
Expand Down Expand Up @@ -341,7 +341,7 @@ async fn handle_topgg(
bot: &Bot,
headers: &HeaderMap,
) -> ApiResult<ProviderResponse> {
let webhook_config = bot.webhooks_config.webhooks.get("topgg").ok_or_else(|| {
let webhook_config = bot.webhooks_config.providers.get("topgg").ok_or_else(|| {
ApiError::WebhookError("Bot does not have webhook configured for top.gg".to_string())
})?;

Expand Down
3 changes: 1 addition & 2 deletions src/domain/models/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ impl Bot {
#[serde(rename_all = "camelCase")]
pub struct WebhooksConfig {
pub webhook_url: Option<String>,
#[serde(flatten)]
pub webhooks: HashMap<String, WebhookConfig>,
pub providers: HashMap<String, WebhookConfig>,
}

#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize, ApiComponent, JsonSchema)]
Expand Down
1 change: 0 additions & 1 deletion src/domain/models/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ use serde::{Deserialize, Serialize};
pub struct Vote {
pub bot_id: String,
pub date: DateTime,
#[serde(flatten)]
pub votes: HashMap<String, u32>,
}
1 change: 0 additions & 1 deletion src/openapi/schemas/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use crate::domain::models::Vote;
pub struct VoteResponse {
pub bot_id: String,
pub date: String,
#[serde(flatten)]
pub votes: HashMap<String, u32>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/webhooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl WebhooksService {
webhook_secret: None,
};

if let Some(webhook_config) = bot.webhooks_config.webhooks.get(provider) {
if let Some(webhook_config) = bot.webhooks_config.providers.get(provider) {
webhook.webhook_secret = Some(match &webhook_config.webhook_secret {
Some(secret) if !secret.is_empty() => secret.clone(),
_ => {
Expand Down