feat: change commands to use the "Manage Server" permission instead of just admin.
This measn that the commands only show up if you can manage teh server
This commit is contained in:
parent
09ce45f70f
commit
7406f0e620
4 changed files with 21 additions and 73 deletions
|
@ -3,15 +3,9 @@ use serenity::{builder::CreateCommand, client::Context};
|
|||
use skynet_discord_bot::common::database::{get_server_config, DataBase, Servers};
|
||||
use skynet_discord_bot::common::set_roles::normal::update_server;
|
||||
use skynet_discord_bot::common::wolves::cns::get_wolves;
|
||||
use skynet_discord_bot::is_admin;
|
||||
use sqlx::{Error, Pool, Sqlite};
|
||||
|
||||
pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
|
||||
// check if user has high enough permisssions
|
||||
if let Some(msg) = is_admin(command, ctx).await {
|
||||
return msg;
|
||||
}
|
||||
|
||||
let wolves_api = if let Some(CommandDataOption {
|
||||
value: CommandDataOptionValue::String(key),
|
||||
..
|
||||
|
@ -83,6 +77,7 @@ pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
|
|||
pub fn register() -> CreateCommand {
|
||||
CreateCommand::new("add")
|
||||
.description("Enable the bot for this discord")
|
||||
.default_member_permissions(serenity::model::Permissions::MANAGE_GUILD)
|
||||
.add_option(CreateCommandOption::new(CommandOptionType::String, "api_key", "UL Wolves API Key").required(true))
|
||||
.add_option(CreateCommandOption::new(CommandOptionType::Role, "role_current", "Role for Current members").required(true))
|
||||
.add_option(CreateCommandOption::new(CommandOptionType::Channel, "bot_channel", "Safe space for folks to use the bot commands.").required(true))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue