Fix typos
This commit is contained in:
parent
7b5626c279
commit
4b4e5cb289
16 changed files with 50 additions and 62 deletions
|
@ -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,5 +1,5 @@
|
|||
// 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,
|
||||
|
@ -7,7 +7,6 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
// use clap::builder::OsStr;
|
||||
use color_eyre::{eyre::bail, Result};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -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,
|
||||
|
||||
|
@ -56,7 +55,6 @@ impl Renderer {
|
|||
};
|
||||
|
||||
this.colors = if args.colors.contains(':') {
|
||||
//? object
|
||||
let obj = args.colors.split(',').map(|s| {
|
||||
let mut iter = s.split(':');
|
||||
let [Some(a), Some(b), None] = std::array::from_fn(|_| iter.next()) else {
|
||||
|
@ -77,12 +75,6 @@ impl Renderer {
|
|||
|
||||
ColorType::Object(colors)
|
||||
} else {
|
||||
//? list
|
||||
// let colors = args.colors.split(",").map(|s| {
|
||||
// s.to_string()
|
||||
// })
|
||||
// .collect::<Vec<String>>();
|
||||
|
||||
let colors = args
|
||||
.colors
|
||||
.split(',')
|
||||
|
@ -158,9 +150,6 @@ impl Renderer {
|
|||
x.min(y)
|
||||
};
|
||||
|
||||
// log::info!("Rendering {fo:?}");
|
||||
|
||||
//? maybe handle this and possibly throw error if its none
|
||||
resvg::render(&tree, usvg::Transform::default().post_scale(scale, scale), &mut pixmap.as_mut());
|
||||
|
||||
pixmap.save_png(fo)?;
|
||||
|
|
|
@ -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) => {
|
||||
|
@ -349,7 +349,7 @@ pub mod update_icon {
|
|||
}
|
||||
|
||||
async fn logo_set(ctx: &Context, db: &Pool<Sqlite>, server: &GuildId, logo_selected: &LogoData) {
|
||||
// add to teh database
|
||||
// add to the database
|
||||
if !logo_set_db(db, logo_selected).await {
|
||||
// something went wrong
|
||||
return;
|
||||
|
|
|
@ -46,7 +46,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;
|
||||
}
|
||||
|
@ -82,7 +82,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:?}");
|
||||
}
|
||||
|
@ -185,14 +185,14 @@ pub mod committee {
|
|||
|
||||
let server = config_global.committee_server;
|
||||
|
||||
// because to use it to update a single user we need to pre-get the members of teh server
|
||||
// because to use it to update a single user we need to pre-get the members of the server
|
||||
let mut members = server.members(&ctx, None, None).await.unwrap_or_default();
|
||||
|
||||
update_committees(&db, ctx, &config_global, &mut members).await;
|
||||
}
|
||||
|
||||
/**
|
||||
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 the committee server
|
||||
*/
|
||||
pub async fn update_committees(db: &Pool<Sqlite>, ctx: &Context, config: &Config, members: &mut Vec<Member>) {
|
||||
let server = config.committee_server;
|
||||
|
@ -224,11 +224,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 {
|
||||
|
@ -294,7 +294,7 @@ pub mod committee {
|
|||
// save it to the db in case of crash or error
|
||||
db_role_set(db, &tmp).await;
|
||||
|
||||
// insert it into teh local cache
|
||||
// insert it into the local cache
|
||||
e.insert(tmp);
|
||||
|
||||
re_order = true;
|
||||
|
@ -327,7 +327,7 @@ pub mod committee {
|
|||
}
|
||||
}
|
||||
|
||||
// now we have a map of all users that should get roles time to go through all the folks on teh server
|
||||
// now we have a map of all users that should get roles time to go through all the folks on the server
|
||||
for member in members {
|
||||
// if member.user.id != 136522490632601600 {
|
||||
// continue;
|
||||
|
@ -363,7 +363,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 {
|
||||
|
@ -401,10 +401,10 @@ pub mod committee {
|
|||
if re_order {
|
||||
let channel_id = role.id_channel.to_owned();
|
||||
if let Some(channel) = channels.get_mut(&channel_id) {
|
||||
// record the position of each of teh C&S channels
|
||||
// record the position of each of the C&S channels
|
||||
positions.push(channel.position);
|
||||
|
||||
// pull out teh channel names
|
||||
// pull out the channel names
|
||||
channel_names.push((role.name_channel.to_owned(), channel_id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
|
|||
use sqlx::{Pool, Sqlite};
|
||||
|
||||
/**
|
||||
This file relates to anything that directly interacts with teh wolves API
|
||||
This file relates to anything that directly interacts with the wolves API
|
||||
*/
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
|
@ -80,7 +80,7 @@ pub mod cns {
|
|||
};
|
||||
let config = config_lock.read().await;
|
||||
|
||||
// set up teh client
|
||||
// set up the client
|
||||
let wolves = wolves_oxidised::Client::new(&config.wolves_url, Some(&config.wolves_api));
|
||||
|
||||
for server_config in get_server_config_bulk(&db).await {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue