Executing sql command requires confirmation now since it can mess up things really badly if user doens't know what they're doing.

This commit is contained in:
Master Kwoth 2017-11-03 08:40:43 +01:00
parent ed12722715
commit 9b0f6993d5
2 changed files with 17 additions and 0 deletions

View File

@ -5,6 +5,7 @@ using NadekoBot.Extensions;
using NadekoBot.Core.Services; using NadekoBot.Core.Services;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Discord;
#if !GLOBAL_NADEKO #if !GLOBAL_NADEKO
namespace NadekoBot.Modules.Administration namespace NadekoBot.Modules.Administration
@ -29,6 +30,21 @@ namespace NadekoBot.Modules.Administration
{ {
try try
{ {
var msg = await Context.Channel.EmbedAsync(new EmbedBuilder()
.WithOkColor()
.WithTitle(GetText("sql_confirm_exec"))
.WithDescription(Format.Code(sql))
.WithFooter("yes/no")).ConfigureAwait(false);
var input = await GetUserInputAsync(Context.User.Id, Context.Channel.Id);
input = input?.ToLowerInvariant().ToString();
if (input != "yes" && input != "y")
{
return;
}
var _ = msg.DeleteAsync();
int res; int res;
using (var uow = _db.UnitOfWork) using (var uow = _db.UnitOfWork)
{ {

View File

@ -662,6 +662,7 @@
"games_pick_sn": "Pick it up by typing `{0}pick`", "games_pick_sn": "Pick it up by typing `{0}pick`",
"gambling_no_users_found": "No user found.", "gambling_no_users_found": "No user found.",
"gambling_page": "page {0}", "gambling_page": "page {0}",
"administration_sql_confirm_exec": "Confirm execution of the following SQL command",
"administration_must_be_in_voice": "You must be in a voice channel on this server.", "administration_must_be_in_voice": "You must be in a voice channel on this server.",
"administration_no_vcroles": "There are no voice channel roles.", "administration_no_vcroles": "There are no voice channel roles.",
"administration_user_muted_time": "{0} has been **muted** from text and voice chat for {1} minutes.", "administration_user_muted_time": "{0} has been **muted** from text and voice chat for {1} minutes.",