html terminal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use super::{return_next, send_ctx, Context, Result};
use crate::bot::player::{self, Players};

#[poise::command(
    slash_command,
    category = "Configuration",
    rename = "add_admin",
    required_permissions = "ADMINISTRATOR",
    default_member_permissions = "ADMINISTRATOR"
)]
/// make somebody a admin
pub async fn add(
    ctx: Context<'_>,
    #[description = "The player to make admin"]
    #[autocomplete = "player::autocomplete"]
    player: String,
) -> Result<()> {
    let player = Players::find(&ctx.data().stdin, player)
        .await
        .unwrap()
        .unwrap();
    send_ctx!(ctx, "admin add {}", player.uuid)?;
    return_next!(ctx)
}

#[poise::command(
    slash_command,
    category = "Configuration",
    rename = "remove_admin",
    required_permissions = "ADMINISTRATOR",
    default_member_permissions = "ADMINISTRATOR"
)]
/// remove the admin status
pub async fn remove(
    ctx: Context<'_>,
    #[description = "The player to remove admin status from"]
    #[autocomplete = "player::autocomplete"]
    player: String,
) -> Result<()> {
    let player = Players::find(&ctx.data().stdin, player)
        .await
        .unwrap()
        .unwrap();
    send_ctx!(ctx, "admin remove {}", player.uuid)?;
    return_next!(ctx)
}