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 {
|
||||
match cooldown_tracker.remaining_cooldown((*ctx).cooldown_context(), &cooldown_durations) {
|
||||
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()
|
||||
.content(format!(
|
||||
"Bots that are ready for use: {ready}\nBots you can use: {s}\nTotal registered bots: \
|
||||
{}",
|
||||
bots.len()
|
||||
"Bots that are ready for use: {ready}\n\
|
||||
Bots you can use: {s}\n\
|
||||
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)
|
||||
.ephemeral(true);
|
||||
|
|
|
@ -21,6 +21,7 @@ pub enum Map {
|
|||
#[name = "Prison"]
|
||||
Prison,
|
||||
}
|
||||
|
||||
#[derive(Debug, poise::ChoiceParameter)]
|
||||
pub enum Mode {
|
||||
#[name = "Casual"]
|
||||
|
@ -31,9 +32,10 @@ pub enum Mode {
|
|||
Challenge,
|
||||
#[name = "Challenge of the week"]
|
||||
Event,
|
||||
//#[name = "Tournament Practice"]
|
||||
//Tournament,
|
||||
#[name = "Helpstart"]
|
||||
Helpstart,
|
||||
}
|
||||
|
||||
#[derive(Debug, poise::ChoiceParameter)]
|
||||
pub enum Difficulty {
|
||||
#[name = "Normal"]
|
||||
|
@ -43,6 +45,7 @@ pub enum Difficulty {
|
|||
#[name = "R.I.P."]
|
||||
Rip,
|
||||
}
|
||||
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
install_context = "Guild",
|
||||
|
@ -73,15 +76,17 @@ pub(crate) async fn lfg(
|
|||
#[rename = "message"]
|
||||
note: Option<String>,
|
||||
) -> Result<(), Error> {
|
||||
let guild_id = ctx.guild_id().unwrap().get();
|
||||
cooldown(&ctx, 600, 300)?;
|
||||
ctx.defer().await?;
|
||||
let current: u8 = current_players.unwrap_or(1);
|
||||
let mut desired: u8 = desired_players.unwrap_or(4);
|
||||
if current >= desired {
|
||||
desired = 4
|
||||
}
|
||||
let map_name: &str = map.name();
|
||||
let new_ping: u64 = match mode {
|
||||
let map_name: &str = match mode {
|
||||
Helpstart => "",
|
||||
_ => map.name(),
|
||||
};
|
||||
let ping: u64 = match mode {
|
||||
Casual => match map {
|
||||
DeadEnd => 1257408106783178752,
|
||||
BadBlood => 1257408198541836459,
|
||||
|
@ -91,11 +96,7 @@ pub(crate) async fn lfg(
|
|||
Speedrun => 1257408362367287367,
|
||||
Challenge => 1257408398631370762,
|
||||
Event => 1257408432063905915,
|
||||
//Tournament => 1210508966036242445,
|
||||
};
|
||||
let ping = match guild_id {
|
||||
1256217633959841853 => new_ping,
|
||||
_ => 0,
|
||||
Helpstart => 1257411572092113017,
|
||||
};
|
||||
let difficulty: Difficulty = match map {
|
||||
DeadEnd | BadBlood | Prison => difficulty.unwrap_or(Normal),
|
||||
|
@ -121,9 +122,11 @@ pub(crate) async fn lfg(
|
|||
.ephemeral(false)
|
||||
.allowed_mentions(CreateAllowedMentions::new().roles(vec![ping]));
|
||||
|
||||
cooldown(&ctx, 600, 300)?;
|
||||
ctx.send(reply).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug, poise::ChoiceParameter)]
|
||||
enum ExpertMap {
|
||||
#[name = "Dead End"]
|
||||
|
@ -137,6 +140,7 @@ enum ExpertMap {
|
|||
#[name = "Speedrun"]
|
||||
Speedrun,
|
||||
}
|
||||
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
install_context = "Guild",
|
||||
|
@ -174,8 +178,7 @@ pub(crate) async fn expert(
|
|||
ROLE_LIST
|
||||
.iter()
|
||||
.skip(2)
|
||||
.map(|tier| [tier[4], tier[5]])
|
||||
.flatten()
|
||||
.flat_map(|tier| [tier[4], tier[5]])
|
||||
.collect(),
|
||||
),
|
||||
ExpertMap::DeadEnd => (
|
||||
|
@ -183,8 +186,7 @@ pub(crate) async fn expert(
|
|||
ROLE_LIST
|
||||
.iter()
|
||||
.skip(2)
|
||||
.map(|tier| [tier[1], tier[5]])
|
||||
.flatten()
|
||||
.flat_map(|tier| [tier[1], tier[5]])
|
||||
.collect(),
|
||||
),
|
||||
ExpertMap::BadBlood => (
|
||||
|
@ -192,8 +194,7 @@ pub(crate) async fn expert(
|
|||
ROLE_LIST
|
||||
.iter()
|
||||
.skip(2)
|
||||
.map(|tier| [tier[2], tier[5]])
|
||||
.flatten()
|
||||
.flat_map(|tier| [tier[2], tier[5]])
|
||||
.collect(),
|
||||
),
|
||||
ExpertMap::AlienArcadium => (
|
||||
|
@ -201,8 +202,7 @@ pub(crate) async fn expert(
|
|||
ROLE_LIST
|
||||
.iter()
|
||||
.skip(2)
|
||||
.map(|tier| [tier[3], tier[5]])
|
||||
.flatten()
|
||||
.flat_map(|tier| [tier[3], tier[5]])
|
||||
.collect(),
|
||||
),
|
||||
};
|
||||
|
@ -224,6 +224,14 @@ pub(crate) async fn expert(
|
|||
.ephemeral(true),
|
||||
};
|
||||
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(())
|
||||
}
|
||||
|
||||
|
@ -232,6 +240,7 @@ enum OtherPing {
|
|||
#[name = "GeoGuessr"]
|
||||
GeoGuessr,
|
||||
}
|
||||
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
install_context = "Guild",
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
use crate::error::Error;
|
||||
use crate::Context;
|
||||
|
||||
const XD: &str = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\\
|
||||
n⣿⣿⣿⡿⠿⠿⠿⠿⠿⠿⠿⢿⣿⣿⣿⣿⡿⠿⠿⠿⠿⠿⠿⠿⢿⡿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\\
|
||||
n⣿⣿⣿⣧⣄⡀⠀⠀⠀⢀⣠⣼⣿⣿⣿⣿⣧⣄⡀⠀⠀⠀⣀⣤⣼⣷⣦⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣿⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠻⣿⣿⣿⣿⣿⣿⠟⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣶⣦⣄⡀⠀⠀⠙⢿⣿⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠙⣿⣿⣿⣿⠋⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠈⢿⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠈⢿⡿⠁⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀⢸⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡗⠀⠀⠀⠐⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠀⠀⠀⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⣠⡀⠀⠀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⣰⣿⣷⡄⠀⠀⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⣾⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⢀⣼⣿⣿⣿⣿⣆⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⢀⣼⣿⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⠋⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠙⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⠿⠛⠁⠀⠀⣠⣾⣿⣿⣿⣿⣿\\
|
||||
n⣿⣿⣿⠿⠛⠁⠀⠀⠀⠙⠻⣿⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠈⠛⠻⡿⠟⠛⠁⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿\\
|
||||
n⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣶⣶⣷⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\\
|
||||
n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n";
|
||||
const XD: &str = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\
|
||||
⣿⣿⣿⡿⠿⠿⠿⠿⠿⠿⠿⢿⣿⣿⣿⣿⡿⠿⠿⠿⠿⠿⠿⠿⢿⡿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\
|
||||
⣿⣿⣿⣧⣄⡀⠀⠀⠀⢀⣠⣼⣿⣿⣿⣿⣧⣄⡀⠀⠀⠀⣀⣤⣼⣷⣦⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣿⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠻⣿⣿⣿⣿⣿⣿⠟⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣶⣦⣄⡀⠀⠀⠙⢿⣿⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠙⣿⣿⣿⣿⠋⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠈⢿⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠈⢿⡿⠁⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀⢸⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡗⠀⠀⠀⠐⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠀⠀⠀⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⣠⡀⠀⠀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⣰⣿⣷⡄⠀⠀⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⣾⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⢀⣼⣿⣿⣿⣿⣆⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⢀⣼⣿⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⠋⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠙⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⣿⠿⠛⠁⠀⠀⣠⣾⣿⣿⣿⣿⣿\
|
||||
⣿⣿⣿⠿⠛⠁⠀⠀⠀⠙⠻⣿⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠈⠛⠻⡿⠟⠛⠁⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿\
|
||||
⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣶⣶⣷⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
|
|
|
@ -9,7 +9,7 @@ pub(crate) struct Bot {
|
|||
username: String,
|
||||
list_type: ListType,
|
||||
list: Vec<String>,
|
||||
strict: bool,
|
||||
//strict: bool,
|
||||
/* we don't care abt lobby data
|
||||
* lobby_name: String,
|
||||
* lobby_number: u8,
|
||||
|
@ -20,7 +20,7 @@ pub(crate) struct Bot {
|
|||
* client_version: String,
|
||||
*/
|
||||
last_updated: f64,
|
||||
last_updated_utc: String, //TODO: DateTime
|
||||
//last_updated_utc: String, //TODO: DateTime
|
||||
note: String,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(integer_sign_cast)]
|
||||
#![feature(duration_constructors)]
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
|
Loading…
Add table
Reference in a new issue