Fix typos
This commit is contained in:
parent
7526a82bb7
commit
7e90f45196
14 changed files with 32 additions and 32 deletions
2
.taplo.toml
Normal file
2
.taplo.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[formatting]
|
||||
column_width = 120
|
|
@ -18,8 +18,8 @@ use tokio::sync::RwLock;
|
|||
|
||||
/// Cleanup teh Committee server
|
||||
///
|
||||
/// This removes any invalid roles/channels which ay have been set up accidentally
|
||||
/// DO NOT run this locally unless you have a fresh copy of teh live database handy.
|
||||
/// This removes any invalid roles/channels which have been set up accidentally
|
||||
/// DO NOT run this locally unless you have a fresh copy of the live database handy.
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let config = get_config();
|
||||
|
|
|
@ -102,7 +102,7 @@ async fn add_server(db: &Pool<Sqlite>, ctx: &Context, server: &Servers) -> Resul
|
|||
.fetch_optional(db)
|
||||
.await;
|
||||
|
||||
// if the entry does not exist already tehn do a user update
|
||||
// if the entry does not exist already then do a user update
|
||||
let (update, current_remove, current_role, past_remove, past_role) = match &existing {
|
||||
None => (true, false, None, false, None),
|
||||
Some(x) => {
|
||||
|
|
|
@ -152,7 +152,7 @@ pub mod servers {
|
|||
|
||||
let length = line.len() + 1;
|
||||
|
||||
// +3 is to account for the closing fense
|
||||
// +3 is to account for the closing fence
|
||||
if length < (limit + 3) {
|
||||
response.push(line);
|
||||
limit -= length;
|
||||
|
|
|
@ -196,7 +196,7 @@ pub(crate) mod server {
|
|||
model::id::GuildId,
|
||||
};
|
||||
use sqlx::Error;
|
||||
// this is to managfe the server side of commands related to minecraft
|
||||
// this is to manage the server side of commands related to minecraft
|
||||
use super::*;
|
||||
use skynet_discord_bot::{
|
||||
common::minecraft::{update_server, Minecraft},
|
||||
|
|
|
@ -147,7 +147,7 @@ pub mod tools {
|
|||
use sqlx::{Pool, Sqlite};
|
||||
|
||||
pub async fn on_role_change(db: &Pool<Sqlite>, ctx: &Context, new_data: Member) {
|
||||
// check if the role changed is part of the oens for this server
|
||||
// check if the role changed is part of the ones for this server
|
||||
if let Ok(role_adders) = sqlx::query_as::<_, RoleAdder>(
|
||||
r#"
|
||||
SELECT *
|
||||
|
@ -163,7 +163,7 @@ pub mod tools {
|
|||
let mut roles_remove = vec![];
|
||||
|
||||
for role_adder in role_adders {
|
||||
// if the user has both A dnd B give them C
|
||||
// if the user has both A and B give them C
|
||||
if new_data.roles.contains(&role_adder.role_a) && new_data.roles.contains(&role_adder.role_b) && !new_data.roles.contains(&role_adder.role_c)
|
||||
{
|
||||
roles_add.push(role_adder.role_c);
|
||||
|
|
|
@ -211,7 +211,7 @@ pub(crate) mod user {
|
|||
|
||||
let length = line.len() + 1;
|
||||
|
||||
// +3 is to account for the closing fense
|
||||
// +3 is to account for the closing fence
|
||||
if length < (limit + 3) {
|
||||
response.push(line);
|
||||
limit -= length;
|
||||
|
|
|
@ -101,7 +101,7 @@ pub mod link {
|
|||
return "Email already verified".to_string();
|
||||
}
|
||||
|
||||
// generate a auth key
|
||||
// generate an auth key
|
||||
let auth = random_string(20);
|
||||
match send_mail(&config, &details.email, &auth, &command.user.name) {
|
||||
Ok(_) => match save_to_db(&db, &details, &auth, &command.user.id).await {
|
||||
|
@ -210,7 +210,7 @@ pub mod link {
|
|||
.subject("Skynet: Link Discord to Wolves.")
|
||||
.multipart(
|
||||
// This is composed of two parts.
|
||||
// also helps not trip spam settings (uneven number of url's
|
||||
// also helps not trip spam settings (uneven number of urls)
|
||||
MultiPart::alternative()
|
||||
.singlepart(SinglePart::builder().header(header::ContentType::TEXT_PLAIN).body(body_text))
|
||||
.singlepart(SinglePart::builder().header(header::ContentType::TEXT_HTML).body(html.into_string())),
|
||||
|
@ -460,7 +460,7 @@ pub mod verify {
|
|||
let config = config_lock.read().await;
|
||||
|
||||
if let Some(x) = get_server_member_discord(db, &discord.id).await {
|
||||
// if they are a member of one or more committees, and in teh committee server then give the teh general committee role
|
||||
// if they are a member of one or more committees, and in teh committee server then give them the general committee role
|
||||
// they will get teh more specific vanity role later
|
||||
if !get_committees_id(db, x.id_wolves).await.is_empty() {
|
||||
let server = config.committee_server;
|
||||
|
@ -500,7 +500,7 @@ pub mod unlink {
|
|||
};
|
||||
let db = db_lock.read().await;
|
||||
|
||||
// dosent matter if there is one or not, it will be removed regardless
|
||||
// doesn't matter if there is one or not, it will be removed regardless
|
||||
delete_link(&db, &command.user.id).await;
|
||||
|
||||
"Discord link removed".to_string()
|
||||
|
|
|
@ -24,7 +24,7 @@ impl<'r> FromRow<'r, SqliteRow> for Minecraft {
|
|||
/**
|
||||
loop through all members of server
|
||||
get a list of folks with mc accounts that are members
|
||||
and a list that arent members
|
||||
and a list that aren't members
|
||||
*/
|
||||
pub async fn update_server(server_id: &str, db: &Pool<Sqlite>, g_id: &GuildId, config: &Config) {
|
||||
let mut usernames = vec![];
|
||||
|
@ -109,7 +109,7 @@ pub async fn whitelist_wipe(server: &str, token: &str) {
|
|||
};
|
||||
post(&format!("{url_base}/files/delete"), &bearer, &deletion).await;
|
||||
|
||||
// recreate teh file, passing in the type here so the compiler knows what type of vec it is
|
||||
// recreate the file, passing in the type here so the compiler knows what type of Vec it is
|
||||
post::<Vec<&str>>(&format!("{url_base}/files/write?file=%2Fwhitelist.json"), &bearer, &vec![]).await;
|
||||
|
||||
// reload the whitelist
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
// this code is taken from https://github.com/MCorange99/svg2colored-png/tree/main
|
||||
// I was unable to figure out how to use usvg myself so younked it from here.
|
||||
// I was unable to figure out how to use usvg myself so yoinked it from here.
|
||||
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
// use clap::builder::OsStr;
|
||||
use color_eyre::{eyre::bail, Result};
|
||||
use usvg_text_layout::TreeTextToPath;
|
||||
|
||||
|
@ -17,7 +16,7 @@ pub struct Args {
|
|||
/// Output folder where the PNG's will be placed
|
||||
pub output: PathBuf,
|
||||
|
||||
/// Comma seperated colors that will be used in HEX Eg. 000000,ffffff
|
||||
/// Comma separated colors that will be used in HEX Eg. 000000,ffffff
|
||||
/// Can be like an object: black:000000,white:ffffff
|
||||
pub colors: String,
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ pub mod update_icon {
|
|||
|
||||
// check if exists
|
||||
if !path_new.exists() {
|
||||
// convert if it hasnt been converted already
|
||||
// convert if it hasn't been converted already
|
||||
match r.render(&path_local, &args) {
|
||||
Ok(_) => {}
|
||||
Err(_e) => {
|
||||
|
|
|
@ -48,7 +48,7 @@ pub mod normal {
|
|||
|
||||
if let Ok(x) = server.members(ctx, None, None).await {
|
||||
for member in x {
|
||||
// members_changed acts as an override to only deal with teh users in it
|
||||
// members_changed acts as an override to only deal with the users in it
|
||||
if !members_changed.is_empty() && !members_changed.contains(&member.user.id) {
|
||||
continue;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ pub mod normal {
|
|||
|
||||
if member.roles.contains(role_current) {
|
||||
roles_set.current_rem += 1;
|
||||
// if theya re not a current member and have the role then remove it
|
||||
// if they're not a current member and have the role then remove it
|
||||
if let Err(e) = member.remove_role(ctx, role_current).await {
|
||||
println!("{e:?}");
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ pub mod committee {
|
|||
}
|
||||
|
||||
/**
|
||||
This function can take a vec of members (or just one) and gives tehm the appropiate roles on teh committee server
|
||||
This function can take a Vec of members (or just one) and gives them the appropriate roles on teh committee server
|
||||
*/
|
||||
pub async fn update_committees(db: &Pool<Sqlite>, ctx: &Context, config: &Config, members: &mut Vec<Member>) {
|
||||
let server = config.committee_server;
|
||||
|
@ -228,11 +228,11 @@ pub mod committee {
|
|||
|
||||
let mut channels = server.channels(&ctx).await.unwrap_or_default();
|
||||
|
||||
// a map of users and the roles they are goign to be getting
|
||||
// a map of users and the roles they are going to be getting
|
||||
let mut users_roles = HashMap::new();
|
||||
|
||||
let mut re_order = false;
|
||||
// we need to create roles and channels if tehy dont already exist
|
||||
// we need to create roles and channels if they don't already exist
|
||||
let mut category_index = 0;
|
||||
let mut i = 0;
|
||||
loop {
|
||||
|
@ -367,7 +367,7 @@ pub mod committee {
|
|||
let has_committee_role = roles_current_id.contains(&committee_member);
|
||||
|
||||
if on_committee && !has_committee_role {
|
||||
// if there are committee roles then give the general purporse role
|
||||
// if there are committee roles then give the general purpose role
|
||||
roles_add.push(committee_member);
|
||||
}
|
||||
if !on_committee && has_committee_role {
|
||||
|
|
|
@ -36,7 +36,7 @@ pub struct Config {
|
|||
pub committee_role: RoleId,
|
||||
pub committee_category: Vec<ChannelId>,
|
||||
|
||||
// items pertaining to compsoc only
|
||||
// items pertaining to CompSoc only
|
||||
pub compsoc_server: GuildId,
|
||||
}
|
||||
impl TypeMapKey for Config {
|
||||
|
|
|
@ -27,7 +27,6 @@ use sqlx::{Pool, Sqlite};
|
|||
use std::sync::Arc;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
// Need To Define The Stuct (Committed To Bump The Bot)
|
||||
struct Handler;
|
||||
|
||||
#[async_trait]
|
||||
|
@ -117,7 +116,7 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
|
|||
|
||||
let db = db_lock.read().await;
|
||||
|
||||
// check if the role changed is part of the oens for this server
|
||||
// check if the role changed is part of the ones for this server
|
||||
if let Some(x) = new_data {
|
||||
on_role_change(&db, &ctx, x).await;
|
||||
}
|
||||
|
@ -159,13 +158,13 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
|
|||
}
|
||||
}
|
||||
|
||||
// compsoc Server
|
||||
// CompSoc Server
|
||||
match config
|
||||
.compsoc_server
|
||||
.set_commands(
|
||||
&ctx.http,
|
||||
vec![
|
||||
// commands just for the compsoc server
|
||||
// commands just for the CompSoc server
|
||||
commands::count::servers::register(),
|
||||
commands::server_icon::user::register(),
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue