Skip to content

Commit

Permalink
Add vote webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
tazz4843 committed Dec 21, 2023
1 parent 508a134 commit f1c8908
Show file tree
Hide file tree
Showing 39 changed files with 519 additions and 459 deletions.

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

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

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

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

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

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

26 changes: 26 additions & 0 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions migrations/20231216214434_vote_reminder_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Add migration script here
CREATE TABLE vote_reminders (
user_id BIGINT NOT NULL,
site_id SMALLINT NOT NULL,
next_reminder TIMESTAMP NOT NULL,

PRIMARY KEY (user_id, site_id)
);
2 changes: 2 additions & 0 deletions migrations/20231217034034_vote_reminder_opt_out.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Add migration script here
ALTER TABLE users ADD COLUMN vote_reminder_disabled BOOLEAN NOT NULL DEFAULT FALSE;
5 changes: 4 additions & 1 deletion scripty_audio_handler/src/events/voice_tick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,10 @@ async fn finalize_stream(
webhook_executor
}
Ok(_) => return (None, None),
Err(error) => handle_error(error, ssrc),
Err(e) => {
error!(%ssrc, "failed to get stream result: {}", e);
return (None, None);
}
};

debug!(%ssrc, "got stream results");
Expand Down
57 changes: 14 additions & 43 deletions scripty_bot_utils/src/background_tasks/tasks/bot_list_poster.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
use std::{sync::Arc, time::Duration};

use reqwest::Client;
use scripty_botlists::*;
use scripty_botlists::{
botlist_me::BotListMe,
discord_bots_gg::DiscordBotsGG,
discordbotlist_com::DiscordBotListCom,
discordextremelist_xyz::DiscordExtremeListXyz,
discords_com::DiscordsCom,
discordservices_net::DiscordServicesNet,
disforge_com::DisforgeCom,
infinitybots_gg::InfinityBotsGG,
top_gg::TopGG,
voidbots_net::VoidBotsNet,
PostStats,
StatPoster,
};
use scripty_config::BotListsConfig;
use serenity::client::Context;

Expand Down Expand Up @@ -51,17 +64,12 @@ enum BotLists {
BotListMe(BotListMe),
DiscordBotsGG(DiscordBotsGG),
DiscordBotListCom(DiscordBotListCom),
DiscordBotListEu(DiscordBotListEu),
DiscordExtremeListXyz(DiscordExtremeListXyz),
DiscordListGG(DiscordListGG),
DiscordsCom(DiscordsCom),
DiscordServicesNet(DiscordServicesNet),
DisforgeCom(DisforgeCom),
InfinityBotsGG(InfinityBotsGG),
MotionDevelopmentTop(MotionDevelopmentTop),
RadarCordNet(RadarCordNet),
TopGG(TopGG),
TopCordXyz(TopCordXyz),
VoidBotsNet(VoidBotsNet),
}

Expand All @@ -76,17 +84,12 @@ impl StatPoster for BotLists {
BotLists::BotListMe(item) => item.post_stats(client, stats).await,
BotLists::DiscordBotsGG(item) => item.post_stats(client, stats).await,
BotLists::DiscordBotListCom(item) => item.post_stats(client, stats).await,
BotLists::DiscordBotListEu(item) => item.post_stats(client, stats).await,
BotLists::DiscordExtremeListXyz(item) => item.post_stats(client, stats).await,
BotLists::DiscordListGG(item) => item.post_stats(client, stats).await,
BotLists::DiscordsCom(item) => item.post_stats(client, stats).await,
BotLists::DiscordServicesNet(item) => item.post_stats(client, stats).await,
BotLists::DisforgeCom(item) => item.post_stats(client, stats).await,
BotLists::InfinityBotsGG(item) => item.post_stats(client, stats).await,
BotLists::MotionDevelopmentTop(item) => item.post_stats(client, stats).await,
BotLists::RadarCordNet(item) => item.post_stats(client, stats).await,
BotLists::TopGG(item) => item.post_stats(client, stats).await,
BotLists::TopCordXyz(item) => item.post_stats(client, stats).await,
BotLists::VoidBotsNet(item) => item.post_stats(client, stats).await,
}
}
Expand Down Expand Up @@ -114,27 +117,13 @@ fn add_bot_lists(bot_lists: &mut Vec<BotLists>, bot_id: u64) {
)));
}

if let Some(BotListsConfig::TokenOnly(token)) = bot_list_cfg.get("discordbotlist_eu") {
bot_lists.push(BotLists::DiscordBotListEu(DiscordBotListEu::new(
token.clone(),
bot_id,
)));
}

if let Some(BotListsConfig::TokenOnly(token)) = bot_list_cfg.get("discordextremelist_xyz") {
bot_lists.push(BotLists::DiscordExtremeListXyz(DiscordExtremeListXyz::new(
token.clone(),
bot_id,
)));
}

if let Some(BotListsConfig::TokenOnly(token)) = bot_list_cfg.get("discordlist_gg") {
bot_lists.push(BotLists::DiscordListGG(DiscordListGG::new(
token.clone(),
bot_id,
)));
}

if let Some(BotListsConfig::TokenOnly(token)) = bot_list_cfg.get("discords_com") {
bot_lists.push(BotLists::DiscordsCom(DiscordsCom::new(
token.clone(),
Expand Down Expand Up @@ -164,28 +153,10 @@ fn add_bot_lists(bot_lists: &mut Vec<BotLists>, bot_id: u64) {
)));
}

if let Some(BotListsConfig::TokenOnly(token)) = bot_list_cfg.get("motiondevelopment_top") {
bot_lists.push(BotLists::MotionDevelopmentTop(MotionDevelopmentTop::new(
token.clone(),
bot_id,
)));
}

if let Some(BotListsConfig::TokenOnly(token)) = bot_list_cfg.get("radarcord_net") {
bot_lists.push(BotLists::RadarCordNet(RadarCordNet::new(
token.clone(),
bot_id,
)));
}

if let Some(BotListsConfig::FullConfig { token, .. }) = bot_list_cfg.get("top_gg") {
bot_lists.push(BotLists::TopGG(TopGG::new(token.clone(), bot_id)));
}

if let Some(BotListsConfig::TokenOnly(token)) = bot_list_cfg.get("topcord_xyz") {
bot_lists.push(BotLists::TopCordXyz(TopCordXyz::new(token.clone(), bot_id)));
}

if let Some(BotListsConfig::TokenOnly(token)) = bot_list_cfg.get("voidbots_net") {
bot_lists.push(BotLists::VoidBotsNet(VoidBotsNet::new(
token.clone(),
Expand Down
4 changes: 0 additions & 4 deletions scripty_botlists/src/lists/discordbotlist_eu/mod.rs

This file was deleted.

11 changes: 0 additions & 11 deletions scripty_botlists/src/lists/discordbotlist_eu/models.rs

This file was deleted.

53 changes: 0 additions & 53 deletions scripty_botlists/src/lists/discordbotlist_eu/trait_impl.rs

This file was deleted.

3 changes: 0 additions & 3 deletions scripty_botlists/src/lists/discordlist_gg/mod.rs

This file was deleted.

Loading

0 comments on commit f1c8908

Please sign in to comment.