feat: new command to see how many of each club/soc are on teh server
This commit is contained in:
parent
0bedf96da5
commit
143483d3b3
4 changed files with 110 additions and 9 deletions
|
@ -221,7 +221,7 @@ pub mod committee {
|
|||
x.name_role = committee.name_full.to_owned();
|
||||
x.name_channel = committee.name_profile.to_owned();
|
||||
}
|
||||
|
||||
|
||||
// handle new clubs/socs
|
||||
if let std::collections::hash_map::Entry::Vacant(e) = roles_db.entry(committee.id) {
|
||||
// create channel
|
||||
|
@ -293,11 +293,13 @@ pub mod committee {
|
|||
// ID in this is the wolves ID, so we need to get a matching discord ID (if one exists)
|
||||
if let Some(x) = get_server_member_discord(db, id_wolves).await {
|
||||
if let Some(member_tmp) = x.discord {
|
||||
let values = users_roles.entry(member_tmp).or_insert(vec![]);
|
||||
values.push(r);
|
||||
if server.member(ctx, &member_tmp).await.is_ok() {
|
||||
let values = users_roles.entry(member_tmp).or_insert(vec![]);
|
||||
values.push(r);
|
||||
|
||||
if let Some(x) = roles_db.get_mut(&committee.id) {
|
||||
x.count += 1;
|
||||
if let Some(x) = roles_db.get_mut(&committee.id) {
|
||||
x.count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,13 +401,13 @@ pub mod committee {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
struct CommitteeRoles {
|
||||
pub struct CommitteeRoles {
|
||||
id_wolves: i64,
|
||||
id_role: RoleId,
|
||||
id_channel: ChannelId,
|
||||
name_role: String,
|
||||
pub name_role: String,
|
||||
name_channel: String,
|
||||
count: i64,
|
||||
pub count: i64,
|
||||
}
|
||||
|
||||
impl<'r> FromRow<'r, SqliteRow> for CommitteeRoles {
|
||||
|
@ -447,7 +449,7 @@ pub mod committee {
|
|||
}
|
||||
}
|
||||
|
||||
async fn db_roles_get(db: &Pool<Sqlite>) -> Vec<CommitteeRoles> {
|
||||
pub async fn db_roles_get(db: &Pool<Sqlite>) -> Vec<CommitteeRoles> {
|
||||
// expiry
|
||||
sqlx::query_as::<_, CommitteeRoles>(
|
||||
"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue