added defer

This commit is contained in:
Stachelbeere1248 2024-07-03 01:16:58 +02:00
parent 43f59e0c49
commit 22360577d0
Signed by: Stachelbeere1248
SSH key fingerprint: SHA256:IozEKdw2dB8TZxkpPdMxcWSoWTIMwoLaCcZJ1AJnY2o
5 changed files with 6 additions and 0 deletions

View file

@ -12,6 +12,7 @@ pub(crate) async fn account(_ctx: Context<'_>) -> Result<(), Error> {
#[poise::command(slash_command)]
pub(crate) async fn add(ctx: Context<'_>, ign: String) -> Result<(), Error> {
ctx.defer_ephemeral().await?;
let pool = ctx.data().sqlite_pool.clone();
let minecraft_uuid = minecraft_uuid_for_username(ign.clone()).await?;
let hypixel_linked_discord = linked_discord_for_uuid(
@ -49,6 +50,7 @@ pub(crate) async fn remove(ctx: Context<'_>) -> Result<(), Error> {
#[poise::command(slash_command)]
pub(crate) async fn list(ctx: Context<'_>, user: Option<User>) -> Result<(), Error> {
ctx.defer_ephemeral().await?;
let user_id = user.clone().map(|user| user.id.get());
let user_name = user.clone().map(|user| user.name);
let author_name = ctx.author().name.clone();

View file

@ -10,6 +10,7 @@ pub(crate) async fn bots(
#[description = "default: 0"]
bots: u8,
) -> Result<(), Error> {
ctx.defer_ephemeral().await?;
*ctx.data().bots.write().await = bots;
let reply = format!("{} bots are now registered as available", bots).to_string();
command_helper::send_simple(ctx, reply).await

View file

@ -13,6 +13,7 @@ pub(crate) async fn helpstart(
#[rename = "current"]
current_players: u8,
) -> Result<(), Error> {
ctx.defer_ephemeral().await?;
let needed_players = 4 - current_players;
let bots = *ctx.data().bots.read().await;

View file

@ -72,6 +72,7 @@ pub(crate) async fn lfg(
#[rename = "message"]
note: Option<String>,
) -> Result<(), Error> {
ctx.defer_ephemeral().await?;
let mut reply: CreateReply = CreateReply::default();
let guild_id = ctx.guild_id().unwrap().get();
reply = match cooldown(&ctx, 600, 300) {

View file

@ -4,6 +4,7 @@ const XD:&str = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
#[poise::command(slash_command)]
pub(crate) async fn xd(ctx: Context<'_>) -> Result<(), Error> {
ctx.defer_ephemeral().await?;
ctx.say(XD).await?;
Ok(())
}