clean-up old zmp server ids

This commit is contained in:
Stachelbeere1248 2024-10-14 12:15:08 +02:00
parent e0d50f68bc
commit 020de4d0b8
Signed by: Stachelbeere1248
SSH key fingerprint: SHA256:IozEKdw2dB8TZxkpPdMxcWSoWTIMwoLaCcZJ1AJnY2o
4 changed files with 39 additions and 89 deletions

View file

@ -31,8 +31,12 @@ pub(crate) fn cooldown(ctx: &Context, user: u64, guild: u64) -> Result<(), Error
member: None, member: None,
__non_exhaustive: (), __non_exhaustive: (),
}; };
match cooldown_tracker.remaining_cooldown((*ctx).cooldown_context(), &cooldown_durations) { if ctx.framework().options.owners.contains(&ctx.author().id) {
Some(remaining) => Err(format!("Please wait {} seconds", remaining.as_secs()).into()), Ok(())
None => Ok(cooldown_tracker.start_cooldown((*ctx).cooldown_context())), } else {
match cooldown_tracker.remaining_cooldown((*ctx).cooldown_context(), &cooldown_durations) {
Some(remaining) => Err(format!("Please wait {} seconds", remaining.as_secs()).into()),
None => Ok(cooldown_tracker.start_cooldown((*ctx).cooldown_context())),
}
} }
} }

View file

@ -19,7 +19,6 @@ pub(crate) async fn helpstart(
let mut reply = CreateReply::default(); let mut reply = CreateReply::default();
let ping = match g { let ping = match g {
1256217633959841853_u64 => 1257411572092113017_u64, 1256217633959841853_u64 => 1257411572092113017_u64,
995300932164276234_u64 => 1008075054971621448_u64,
_ => 0_u64 _ => 0_u64
}; };

View file

@ -1,6 +1,5 @@
use poise::{ChoiceParameter, CreateReply}; use poise::{ChoiceParameter, CreateReply};
use serenity::all::{CreateAllowedMentions, RoleId}; use serenity::all::{CreateAllowedMentions, RoleId};
//from main.rs //from main.rs
use crate::commands::command_helper::cooldown; use crate::commands::command_helper::cooldown;
use crate::{Context, Error}; use crate::{Context, Error};
@ -72,8 +71,8 @@ pub(crate) async fn lfg(
#[rename = "message"] #[rename = "message"]
note: Option<String>, note: Option<String>,
) -> Result<(), Error> { ) -> Result<(), Error> {
let mut reply: CreateReply = CreateReply::default();
let guild_id = ctx.guild_id().unwrap().get(); let guild_id = ctx.guild_id().unwrap().get();
let mut reply: CreateReply = CreateReply::default();
reply = match cooldown(&ctx, 600, 300) { reply = match cooldown(&ctx, 600, 300) {
Ok(_) => { Ok(_) => {
let current: u8 = current_players.unwrap_or(1); let current: u8 = current_players.unwrap_or(1);
@ -82,18 +81,6 @@ pub(crate) async fn lfg(
desired = 4 desired = 4
} }
let map_name: &str = map.name(); let map_name: &str = map.name();
let old_ping: u64 = match mode {
Casual => match map {
DeadEnd => 1005837123921915914,
BadBlood => 1140190470698438666,
AlienArcadium => 1105917281898336356,
Prison => 1253440747454333009,
},
Speedrun => 1005836989595144243,
Challenge => 1005836864680361994,
Event => 1175116511095050331,
//Tournament => 1210508966036242445,
};
let new_ping: u64 = match mode { let new_ping: u64 = match mode {
Casual => match map { Casual => match map {
DeadEnd => 1257408106783178752, DeadEnd => 1257408106783178752,
@ -108,7 +95,6 @@ pub(crate) async fn lfg(
}; };
let ping = match guild_id { let ping = match guild_id {
1256217633959841853 => new_ping, 1256217633959841853 => new_ping,
995300932164276234 => old_ping,
_ => 0, _ => 0,
}; };
let difficulty: Difficulty = match map { let difficulty: Difficulty = match map {
@ -144,13 +130,15 @@ pub(crate) async fn lfg(
Ok(()) Ok(())
} }
#[derive(Debug, poise::ChoiceParameter)] #[derive(Debug, poise::ChoiceParameter)]
enum Expert { enum ExpertMap {
#[name = "Dead End"] #[name = "Dead End"]
DeadEnd, DeadEnd,
#[name = "Bad Blood"] #[name = "Bad Blood"]
BadBlood, BadBlood,
#[name = "Alien Arcadium"] #[name = "Alien Arcadium"]
AlienArcadium, AlienArcadium,
//#[name = "Prison"]
//Prison,
#[name = "Speedrun"] #[name = "Speedrun"]
Speedrun, Speedrun,
} }
@ -158,7 +146,7 @@ enum Expert {
pub(crate) async fn expert( pub(crate) async fn expert(
ctx: Context<'_>, ctx: Context<'_>,
#[rename = "map"] mode: Expert, #[rename = "map"] mode: ExpertMap,
#[min = 1_u8] #[min = 1_u8]
#[max = 3_u8] #[max = 3_u8]
@ -183,77 +171,24 @@ pub(crate) async fn expert(
let current: u8 = current_players.unwrap_or(1); let current: u8 = current_players.unwrap_or(1);
let mut desired: u8 = desired_players.unwrap_or(4); let mut desired: u8 = desired_players.unwrap_or(4);
if current >= desired { if current >= desired {
desired = 4 desired = 4;
} };
//TODO ZMPv2
let (ping, allowed_roles): (u64, Vec<u64>) = match mode { let (ping, allowed_roles): (u64, Vec<u64>) = match mode {
Expert::Speedrun => ( ExpertMap::Speedrun => (
1243676538067488828, 1295322375637958716,
vec![ ROLE_LIST.iter().skip(2).map(|tier| [tier[4], tier[5]]).flatten().collect()
1235975301461184513,
1235975620400386172,
1235975954413654167,
1235976165345329162,
1235976366109753404,
1235967416605872179,
1235967676048740434,
1235968713354907648,
1235968958511841351,
1235969159679180860,
1236226368052658217,
1173396223592513647,
],
), ),
Expert::DeadEnd => ( ExpertMap::DeadEnd => (
1243675610895880366, 1295321319344177172,
vec![ ROLE_LIST.iter().skip(2).map(|tier| [tier[1], tier[5]]).flatten().collect()
1235975562498015354,
1235975873187020900,
1235976093517746227,
1235976301702156359,
1235976469683896441,
1235967416605872179,
1235967676048740434,
1235968713354907648,
1235968958511841351,
1235969159679180860,
1236226368052658217,
1173396223592513647,
],
), ),
Expert::BadBlood => ( ExpertMap::BadBlood => (
1243676387634708491, 1295322259631640607,
vec![ ROLE_LIST.iter().skip(2).map(|tier| [tier[2], tier[5]]).flatten().collect()
1235975518529261599,
1235975747219357706,
1235976055769268274,
1235976257414631464,
1235976434724376728,
1235967416605872179,
1235967676048740434,
1235968713354907648,
1235968958511841351,
1235969159679180860,
1236226368052658217,
1173396223592513647,
],
), ),
Expert::AlienArcadium => ( ExpertMap::AlienArcadium => (
1243676465829249116, 1295322327910842441,
vec![ ROLE_LIST.iter().skip(2).map(|tier| [tier[3], tier[5]]).flatten().collect()
1235975471968157851,
1235975697487364237,
1235975991617130567,
1235976216469835926,
1235976398380863549,
1235967416605872179,
1235967676048740434,
1235968713354907648,
1235968958511841351,
1235969159679180860,
1236226368052658217,
1173396223592513647,
],
), ),
}; };
let is_expert: bool = ctx let is_expert: bool = ctx
@ -282,3 +217,15 @@ pub(crate) async fn expert(
} }
Ok(()) Ok(())
} }
const ROLE_LIST: [[u64;6]; 9] = [ // [[basic, de, bb, aa, sr, star]; 9]
[1256229103678259311, 1256229192744304670, 1256229223450935377, 1256229498899271754, 1256229540900900996, 1256229575269154866], //novice
[1256230831131983932, 1256230750827577447, 1256230776828334143, 1256230793630715975, 1256230818444214333, 1256230734642024468], //seasoned
[1256230723455553556, 1256230653083521045, 1256230666786443310, 1256230686214324255, 1256230704061353995, 1256230636721537097], //expert
[1256230625635995718, 1256230573203128370, 1256230582908747776, 1256230600025706506, 1256230610998005872, 1256230557897986068], //pro
[1256230543532626002, 1256230480823582861, 1256230502273126421, 1256230515355160597, 1256230531478065243, 1256230463241191494], //master
[1256230442907074703, 1256230359419588700, 1256230396719403141, 1256230416516649012, 1256230429212545025, 1256230346848997396], //grandmaster
[1256230332169060362, 1256230266889044020, 1256230288888168458, 1256230416516649012, 1256230316528631870, 1256230242943766651], //legend
[1256230231732387950, 1256230157967163495, 1256230181199151254, 1256230194499420223, 1256230207099244646, 1256230102627258449], //divine
[1256230002597302322, 1256229873064869939, 1256229929247440906, 1256229963166646314, 1256229982569627792, 1256229672598110218], //goat
];

View file

@ -90,7 +90,7 @@ async fn main() {
GatewayIntents::non_privileged() | GatewayIntents::MESSAGE_CONTENT | GatewayIntents::GUILD_MEMBERS; GatewayIntents::non_privileged() | GatewayIntents::MESSAGE_CONTENT | GatewayIntents::GUILD_MEMBERS;
let client = serenity::ClientBuilder::new(token, intents) let client = serenity::ClientBuilder::new(token, intents)
.framework(framework) .framework(framework)
.activity(ActivityData::playing("arcade_zombies_prison")) .activity(ActivityData::custom("NPC moment..."))
.await; .await;
client.unwrap().start_autosharded().await.unwrap() client.unwrap().start_autosharded().await.unwrap()
} }