From e36e718f282d814c7578f492a0642115799123a5 Mon Sep 17 00:00:00 2001 From: jellywx Date: Tue, 26 Oct 2021 21:10:14 +0100 Subject: [PATCH] removed all guild data related code --- Cargo.lock | 1 - Cargo.toml | 1 - src/commands/info_cmds.rs | 12 +- src/commands/moderation_cmds.rs | 2 +- src/commands/reminder_cmds.rs | 1 - src/consts.rs | 60 +++------- src/framework.rs | 189 ++++++-------------------------- src/hooks.rs | 2 +- src/main.rs | 75 +------------ src/models/guild_data.rs | 77 ------------- src/models/mod.rs | 57 +--------- 11 files changed, 63 insertions(+), 414 deletions(-) delete mode 100644 src/models/guild_data.rs diff --git a/Cargo.lock b/Cargo.lock index 145c9da..9bfd848 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1201,7 +1201,6 @@ dependencies = [ "base64", "chrono", "chrono-tz", - "dashmap", "dotenv", "env_logger", "humantime", diff --git a/Cargo.toml b/Cargo.toml index 4d08e9e..6ae6bd9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ authors = ["jellywx "] edition = "2018" [dependencies] -dashmap = "4.0" dotenv = "0.15" humantime = "2.1" tokio = { version = "1", features = ["process", "full"] } diff --git a/src/commands/info_cmds.rs b/src/commands/info_cmds.rs index 7aa0410..d3ad491 100644 --- a/src/commands/info_cmds.rs +++ b/src/commands/info_cmds.rs @@ -3,7 +3,6 @@ use regex_command_attr::command; use serenity::{builder::CreateEmbedFooter, client::Context}; use crate::{ - consts::DEFAULT_PREFIX, framework::{CommandInvoke, CreateGenericResponse}, models::CtxData, THEME_COLOR, @@ -28,8 +27,6 @@ fn footer(ctx: &Context) -> impl FnOnce(&mut CreateEmbedFooter) -> &mut CreateEm #[description("Get information about the bot")] #[group("Info")] async fn info(ctx: &Context, invoke: &mut CommandInvoke) { - let prefix = ctx.prefix(invoke.guild_id()).await; - let current_user = ctx.cache.current_user(); let footer = footer(ctx); let _ = invoke @@ -38,18 +35,15 @@ async fn info(ctx: &Context, invoke: &mut CommandInvoke) { CreateGenericResponse::new().embed(|e| { e.title("Info") .description(format!( - "Default prefix: `{default_prefix}` -Reset prefix: `@{user} prefix {default_prefix}` -Help: `{prefix}help`**Welcome to Reminder Bot!** + "Help: `/help` + +**Welcome to Reminder Bot!** Developer: <@203532103185465344> Icon: <@253202252821430272> Find me on https://discord.jellywx.com and on https://github.com/JellyWX :) Invite the bot: https://invite.reminder-bot.com/ Use our dashboard: https://reminder-bot.com/", - default_prefix = *DEFAULT_PREFIX, - user = current_user.name, - prefix = prefix )) .footer(footer) .color(*THEME_COLOR) diff --git a/src/commands/moderation_cmds.rs b/src/commands/moderation_cmds.rs index 6b36896..6d17ced 100644 --- a/src/commands/moderation_cmds.rs +++ b/src/commands/moderation_cmds.rs @@ -12,7 +12,7 @@ use crate::{ consts::{EMBED_DESCRIPTION_MAX_LENGTH, THEME_COLOR}, framework::{CommandInvoke, CommandOptions, CreateGenericResponse, OptionValue}, hooks::{CHECK_GUILD_PERMISSIONS_HOOK, CHECK_MANAGED_PERMISSIONS_HOOK}, - models::{channel_data::ChannelData, command_macro::CommandMacro, CtxData}, + models::{command_macro::CommandMacro, CtxData}, PopularTimezones, RecordingMacros, RegexFramework, SQLPool, }; diff --git a/src/commands/reminder_cmds.rs b/src/commands/reminder_cmds.rs index a94baa9..e24fbd8 100644 --- a/src/commands/reminder_cmds.rs +++ b/src/commands/reminder_cmds.rs @@ -11,7 +11,6 @@ use regex_command_attr::command; use serenity::{builder::CreateEmbed, client::Context, model::channel::Channel}; use crate::{ - check_subscription_on_message, component_models::{ pager::{DelPager, LookPager, Pager}, ComponentDataModel, DelSelector, diff --git a/src/consts.rs b/src/consts.rs index 7cb18a9..8bc6301 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -10,42 +10,22 @@ const THEME_COLOR_FALLBACK: u32 = 0x8fb677; use std::{collections::HashSet, env, iter::FromIterator}; -use regex::{Regex, RegexBuilder}; +use regex::Regex; use serenity::http::AttachmentType; lazy_static! { pub static ref DEFAULT_AVATAR: AttachmentType<'static> = ( - include_bytes!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/assets/", - env!("WEBHOOK_AVATAR", "WEBHOOK_AVATAR not provided for compilation") - )) as &[u8], - env!("WEBHOOK_AVATAR"), -) - .into(); - + include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/assets/", + env!("WEBHOOK_AVATAR", "WEBHOOK_AVATAR not provided for compilation") + )) as &[u8], + env!("WEBHOOK_AVATAR"), + ) + .into(); pub static ref REGEX_CHANNEL: Regex = Regex::new(r#"^\s*<#(\d+)>\s*$"#).unwrap(); - pub static ref REGEX_ROLE: Regex = Regex::new(r#"<@&(\d+)>"#).unwrap(); - - pub static ref REGEX_CONTENT_SUBSTITUTION: Regex = Regex::new(r#"<<((?P\d+)|(?P.{1,100}))>>"#).unwrap(); - pub static ref REGEX_CHANNEL_USER: Regex = Regex::new(r#"\s*<(#|@)(?:!)?(\d+)>\s*"#).unwrap(); - - pub static ref REGEX_NATURAL_COMMAND_1: Regex = RegexBuilder::new( - r#"(?P