mirror of
https://github.com/Syping/dtranslatebot.git
synced 2024-11-22 13:50:22 +01:00
open list command to everyone, but limit information
This commit is contained in:
parent
9f91c960b0
commit
ed1b93037c
1 changed files with 16 additions and 13 deletions
|
@ -40,6 +40,9 @@ void bot::slashcommands::process_list_command(dpp::cluster *bot, bot::settings::
|
||||||
reply_translated << "Source: " << channel->source << '\n';
|
reply_translated << "Source: " << channel->source << '\n';
|
||||||
reply_translated << "Targets: " << channel->targets.size();
|
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();
|
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);
|
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 << "Deleteable: " << (db_found ? "Yes" : "No") << '\n';
|
||||||
reply_translated << "Webhook: " << target->webhook.id;
|
reply_translated << "Webhook: " << target->webhook.id;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
event.reply(dpp::message(reply_translated.str()).set_flags(dpp::m_ephemeral));
|
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);
|
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 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");
|
dpp::command_option guild_list_subcommand(dpp::co_sub_command, "guild", "List current guild translation settings");
|
||||||
command_list.add_option(channel_list_subcommand);
|
command_list.add_option(channel_list_subcommand);
|
||||||
|
|
Loading…
Reference in a new issue