reimpl helpstart ping
This commit is contained in:
parent
20c7110710
commit
8442ddb672
7 changed files with 570 additions and 402 deletions
875
Cargo.lock
generated
875
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -18,7 +18,10 @@ pub(crate) fn cooldown(ctx: &Context, user: u64, guild: u64) -> Result<(), Error
|
||||||
} else {
|
} else {
|
||||||
match cooldown_tracker.remaining_cooldown((*ctx).cooldown_context(), &cooldown_durations) {
|
match cooldown_tracker.remaining_cooldown((*ctx).cooldown_context(), &cooldown_durations) {
|
||||||
Some(remaining) => Err(Error::OnCooldown(remaining)),
|
Some(remaining) => Err(Error::OnCooldown(remaining)),
|
||||||
None => Ok(cooldown_tracker.start_cooldown((*ctx).cooldown_context())),
|
None => {
|
||||||
|
cooldown_tracker.start_cooldown((*ctx).cooldown_context());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,9 +82,13 @@ pub(crate) async fn helpstart(ctx: Context<'_>, user: Option<String>) -> Result<
|
||||||
|
|
||||||
let reply = CreateReply::default()
|
let reply = CreateReply::default()
|
||||||
.content(format!(
|
.content(format!(
|
||||||
"Bots that are ready for use: {ready}\nBots you can use: {s}\nTotal registered bots: \
|
"Bots that are ready for use: {ready}\n\
|
||||||
{}",
|
Bots you can use: {s}\n\
|
||||||
bots.len()
|
Total registered bots: {}\n\
|
||||||
|
{}\n{}",
|
||||||
|
bots.len(),
|
||||||
|
"-# Information on the musava helpstart project can be found here: [google doc by musava](<https://docs.google.com/document/d/1oPaRYe8pmvM5yTTxM-zbe9R2K1gGNpi291M4hAVIwck>)",
|
||||||
|
"-# Press the button below to view notes of bots you aren't whitelisted for, if a note is provided by the owner."
|
||||||
))
|
))
|
||||||
.components(components)
|
.components(components)
|
||||||
.ephemeral(true);
|
.ephemeral(true);
|
||||||
|
|
|
@ -21,6 +21,7 @@ pub enum Map {
|
||||||
#[name = "Prison"]
|
#[name = "Prison"]
|
||||||
Prison,
|
Prison,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, poise::ChoiceParameter)]
|
#[derive(Debug, poise::ChoiceParameter)]
|
||||||
pub enum Mode {
|
pub enum Mode {
|
||||||
#[name = "Casual"]
|
#[name = "Casual"]
|
||||||
|
@ -31,9 +32,10 @@ pub enum Mode {
|
||||||
Challenge,
|
Challenge,
|
||||||
#[name = "Challenge of the week"]
|
#[name = "Challenge of the week"]
|
||||||
Event,
|
Event,
|
||||||
//#[name = "Tournament Practice"]
|
#[name = "Helpstart"]
|
||||||
//Tournament,
|
Helpstart,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, poise::ChoiceParameter)]
|
#[derive(Debug, poise::ChoiceParameter)]
|
||||||
pub enum Difficulty {
|
pub enum Difficulty {
|
||||||
#[name = "Normal"]
|
#[name = "Normal"]
|
||||||
|
@ -43,6 +45,7 @@ pub enum Difficulty {
|
||||||
#[name = "R.I.P."]
|
#[name = "R.I.P."]
|
||||||
Rip,
|
Rip,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[poise::command(
|
#[poise::command(
|
||||||
slash_command,
|
slash_command,
|
||||||
install_context = "Guild",
|
install_context = "Guild",
|
||||||
|
@ -73,15 +76,17 @@ pub(crate) async fn lfg(
|
||||||
#[rename = "message"]
|
#[rename = "message"]
|
||||||
note: Option<String>,
|
note: Option<String>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let guild_id = ctx.guild_id().unwrap().get();
|
ctx.defer().await?;
|
||||||
cooldown(&ctx, 600, 300)?;
|
|
||||||
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
|
||||||
}
|
}
|
||||||
let map_name: &str = map.name();
|
let map_name: &str = match mode {
|
||||||
let new_ping: u64 = match mode {
|
Helpstart => "",
|
||||||
|
_ => map.name(),
|
||||||
|
};
|
||||||
|
let ping: u64 = match mode {
|
||||||
Casual => match map {
|
Casual => match map {
|
||||||
DeadEnd => 1257408106783178752,
|
DeadEnd => 1257408106783178752,
|
||||||
BadBlood => 1257408198541836459,
|
BadBlood => 1257408198541836459,
|
||||||
|
@ -91,11 +96,7 @@ pub(crate) async fn lfg(
|
||||||
Speedrun => 1257408362367287367,
|
Speedrun => 1257408362367287367,
|
||||||
Challenge => 1257408398631370762,
|
Challenge => 1257408398631370762,
|
||||||
Event => 1257408432063905915,
|
Event => 1257408432063905915,
|
||||||
//Tournament => 1210508966036242445,
|
Helpstart => 1257411572092113017,
|
||||||
};
|
|
||||||
let ping = match guild_id {
|
|
||||||
1256217633959841853 => new_ping,
|
|
||||||
_ => 0,
|
|
||||||
};
|
};
|
||||||
let difficulty: Difficulty = match map {
|
let difficulty: Difficulty = match map {
|
||||||
DeadEnd | BadBlood | Prison => difficulty.unwrap_or(Normal),
|
DeadEnd | BadBlood | Prison => difficulty.unwrap_or(Normal),
|
||||||
|
@ -121,9 +122,11 @@ pub(crate) async fn lfg(
|
||||||
.ephemeral(false)
|
.ephemeral(false)
|
||||||
.allowed_mentions(CreateAllowedMentions::new().roles(vec![ping]));
|
.allowed_mentions(CreateAllowedMentions::new().roles(vec![ping]));
|
||||||
|
|
||||||
|
cooldown(&ctx, 600, 300)?;
|
||||||
ctx.send(reply).await?;
|
ctx.send(reply).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, poise::ChoiceParameter)]
|
#[derive(Debug, poise::ChoiceParameter)]
|
||||||
enum ExpertMap {
|
enum ExpertMap {
|
||||||
#[name = "Dead End"]
|
#[name = "Dead End"]
|
||||||
|
@ -137,6 +140,7 @@ enum ExpertMap {
|
||||||
#[name = "Speedrun"]
|
#[name = "Speedrun"]
|
||||||
Speedrun,
|
Speedrun,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[poise::command(
|
#[poise::command(
|
||||||
slash_command,
|
slash_command,
|
||||||
install_context = "Guild",
|
install_context = "Guild",
|
||||||
|
@ -174,8 +178,7 @@ pub(crate) async fn expert(
|
||||||
ROLE_LIST
|
ROLE_LIST
|
||||||
.iter()
|
.iter()
|
||||||
.skip(2)
|
.skip(2)
|
||||||
.map(|tier| [tier[4], tier[5]])
|
.flat_map(|tier| [tier[4], tier[5]])
|
||||||
.flatten()
|
|
||||||
.collect(),
|
.collect(),
|
||||||
),
|
),
|
||||||
ExpertMap::DeadEnd => (
|
ExpertMap::DeadEnd => (
|
||||||
|
@ -183,8 +186,7 @@ pub(crate) async fn expert(
|
||||||
ROLE_LIST
|
ROLE_LIST
|
||||||
.iter()
|
.iter()
|
||||||
.skip(2)
|
.skip(2)
|
||||||
.map(|tier| [tier[1], tier[5]])
|
.flat_map(|tier| [tier[1], tier[5]])
|
||||||
.flatten()
|
|
||||||
.collect(),
|
.collect(),
|
||||||
),
|
),
|
||||||
ExpertMap::BadBlood => (
|
ExpertMap::BadBlood => (
|
||||||
|
@ -192,8 +194,7 @@ pub(crate) async fn expert(
|
||||||
ROLE_LIST
|
ROLE_LIST
|
||||||
.iter()
|
.iter()
|
||||||
.skip(2)
|
.skip(2)
|
||||||
.map(|tier| [tier[2], tier[5]])
|
.flat_map(|tier| [tier[2], tier[5]])
|
||||||
.flatten()
|
|
||||||
.collect(),
|
.collect(),
|
||||||
),
|
),
|
||||||
ExpertMap::AlienArcadium => (
|
ExpertMap::AlienArcadium => (
|
||||||
|
@ -201,8 +202,7 @@ pub(crate) async fn expert(
|
||||||
ROLE_LIST
|
ROLE_LIST
|
||||||
.iter()
|
.iter()
|
||||||
.skip(2)
|
.skip(2)
|
||||||
.map(|tier| [tier[3], tier[5]])
|
.flat_map(|tier| [tier[3], tier[5]])
|
||||||
.flatten()
|
|
||||||
.collect(),
|
.collect(),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
@ -224,6 +224,14 @@ pub(crate) async fn expert(
|
||||||
.ephemeral(true),
|
.ephemeral(true),
|
||||||
};
|
};
|
||||||
ctx.send(reply).await?;
|
ctx.send(reply).await?;
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default()
|
||||||
|
.content(
|
||||||
|
"Please be aware of the musava helpstart project. Use /helpstart as reference.",
|
||||||
|
)
|
||||||
|
.ephemeral(true),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,6 +240,7 @@ enum OtherPing {
|
||||||
#[name = "GeoGuessr"]
|
#[name = "GeoGuessr"]
|
||||||
GeoGuessr,
|
GeoGuessr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[poise::command(
|
#[poise::command(
|
||||||
slash_command,
|
slash_command,
|
||||||
install_context = "Guild",
|
install_context = "Guild",
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::Context;
|
use crate::Context;
|
||||||
|
|
||||||
const XD: &str = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\\
|
const XD: &str = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\
|
||||||
n⣿⣿⣿⡿⠿⠿⠿⠿⠿⠿⠿⢿⣿⣿⣿⣿⡿⠿⠿⠿⠿⠿⠿⠿⢿⡿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\\
|
⣿⣿⣿⡿⠿⠿⠿⠿⠿⠿⠿⢿⣿⣿⣿⣿⡿⠿⠿⠿⠿⠿⠿⠿⢿⡿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\
|
||||||
n⣿⣿⣿⣧⣄⡀⠀⠀⠀⢀⣠⣼⣿⣿⣿⣿⣧⣄⡀⠀⠀⠀⣀⣤⣼⣷⣦⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣿⣿⣿⣿\\
|
⣿⣿⣿⣧⣄⡀⠀⠀⠀⢀⣠⣼⣿⣿⣿⣿⣧⣄⡀⠀⠀⠀⣀⣤⣼⣷⣦⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣿⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠻⣿⣿⣿⣿⣿⣿⠟⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣶⣦⣄⡀⠀⠀⠙⢿⣿⣿⣿⣿\\
|
⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠻⣿⣿⣿⣿⣿⣿⠟⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣶⣦⣄⡀⠀⠀⠙⢿⣿⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠙⣿⣿⣿⣿⠋⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠈⢿⣿⣿⣿\\
|
⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠙⣿⣿⣿⣿⠋⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠈⢿⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠈⢿⡿⠁⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀⢸⣿⣿⣿\\
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠈⢿⡿⠁⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀⢸⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⣿⣿⣿\\
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡗⠀⠀⠀⠐⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠀⠀⠀⣿⣿⣿\\
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡗⠀⠀⠀⠐⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠀⠀⠀⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⣠⡀⠀⠀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿\\
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⣠⡀⠀⠀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⣰⣿⣷⡄⠀⠀⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⣾⣿⣿⣿\\
|
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⣰⣿⣷⡄⠀⠀⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⣾⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⢀⣼⣿⣿⣿⣿⣆⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⢀⣼⣿⣿⣿⣿\\
|
⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⢀⣼⣿⣿⣿⣿⣆⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⢀⣼⣿⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⠋⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠙⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⠿⠛⠁⠀⠀⣠⣾⣿⣿⣿⣿⣿\\
|
⣿⣿⣿⣿⣿⣿⠋⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠙⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⠿⠛⠁⠀⠀⣠⣾⣿⣿⣿⣿⣿\
|
||||||
n⣿⣿⣿⠿⠛⠁⠀⠀⠀⠙⠻⣿⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠈⠛⠻⡿⠟⠛⠁⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿\\
|
⣿⣿⣿⠿⠛⠁⠀⠀⠀⠙⠻⣿⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠈⠛⠻⡿⠟⠛⠁⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿\
|
||||||
n⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣶⣶⣷⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\\
|
⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣶⣶⣷⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\
|
||||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n";
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||||
|
|
||||||
#[poise::command(
|
#[poise::command(
|
||||||
slash_command,
|
slash_command,
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub(crate) struct Bot {
|
||||||
username: String,
|
username: String,
|
||||||
list_type: ListType,
|
list_type: ListType,
|
||||||
list: Vec<String>,
|
list: Vec<String>,
|
||||||
strict: bool,
|
//strict: bool,
|
||||||
/* we don't care abt lobby data
|
/* we don't care abt lobby data
|
||||||
* lobby_name: String,
|
* lobby_name: String,
|
||||||
* lobby_number: u8,
|
* lobby_number: u8,
|
||||||
|
@ -20,7 +20,7 @@ pub(crate) struct Bot {
|
||||||
* client_version: String,
|
* client_version: String,
|
||||||
*/
|
*/
|
||||||
last_updated: f64,
|
last_updated: f64,
|
||||||
last_updated_utc: String, //TODO: DateTime
|
//last_updated_utc: String, //TODO: DateTime
|
||||||
note: String,
|
note: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#![feature(integer_sign_cast)]
|
|
||||||
#![feature(duration_constructors)]
|
#![feature(duration_constructors)]
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
Loading…
Add table
Reference in a new issue