open list command to everyone, but limit information

This commit is contained in:
Syping 2024-02-18 20:34:01 +01:00
parent 9f91c960b0
commit ed1b93037c

View file

@ -40,6 +40,9 @@ void bot::slashcommands::process_list_command(dpp::cluster *bot, bot::settings::
reply_translated << "Source: " << channel->source << '\n';
reply_translated << "Targets: " << channel->targets.size();
// We want give more information to users who can Manage Webhooks
dpp::permission user_permissions = event.command.get_resolved_permission(event.command.usr.id);
if (user_permissions.has(dpp::p_manage_webhooks)) {
std::shared_ptr<bot::database::database> database = settings->get_database();
const bot::settings::channel db_channel = database->get_channel(event.command.guild_id, event.command.channel_id);
@ -56,6 +59,7 @@ void bot::slashcommands::process_list_command(dpp::cluster *bot, bot::settings::
reply_translated << "Deleteable: " << (db_found ? "Yes" : "No") << '\n';
reply_translated << "Webhook: " << target->webhook.id;
}
}
event.reply(dpp::message(reply_translated.str()).set_flags(dpp::m_ephemeral));
}
@ -259,7 +263,6 @@ void bot::slashcommands::register_commands(dpp::cluster *bot, bot::settings::set
*/
dpp::slashcommand command_list("list", "List translation settings", bot->me.id);
command_list.set_default_permissions(dpp::p_manage_webhooks);
dpp::command_option channel_list_subcommand(dpp::co_sub_command, "channel", "List current channel translation settings");
dpp::command_option guild_list_subcommand(dpp::co_sub_command, "guild", "List current guild translation settings");
command_list.add_option(channel_list_subcommand);