.v+t localizable. (only) main file left
This commit is contained in:
parent
431f328bb4
commit
0d0938f613
@ -65,10 +65,15 @@ namespace NadekoBot.Modules.Administration
|
||||
try
|
||||
{
|
||||
await guild.Owner.SendErrorAsync(
|
||||
"⚠️ I don't have **manage server** and/or **manage channels** permission," +
|
||||
$" so I cannot run `voice+text` on **{guild.Name}** server.").ConfigureAwait(false);
|
||||
GetTextStatic("vt_exit",
|
||||
NadekoBot.Localization.GetCultureInfo(guild),
|
||||
typeof(Administration).Name.ToLowerInvariant(),
|
||||
Format.Bold(guild.Name))).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
catch { }
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
uow.GuildConfigs.For(guild.Id, set => set).VoicePlusTextEnabled = false;
|
||||
@ -105,9 +110,8 @@ namespace NadekoBot.Modules.Administration
|
||||
if (afterVch != null && guild.AFKChannel?.Id != afterVch.Id)
|
||||
{
|
||||
var roleName = GetRoleName(afterVch);
|
||||
IRole roleToAdd = guild.Roles.FirstOrDefault(x => x.Name == roleName);
|
||||
if (roleToAdd == null)
|
||||
roleToAdd = await guild.CreateRoleAsync(roleName, GuildPermissions.None).ConfigureAwait(false);
|
||||
var roleToAdd = guild.Roles.FirstOrDefault(x => x.Name == roleName) ??
|
||||
(IRole) await guild.CreateRoleAsync(roleName, GuildPermissions.None).ConfigureAwait(false);
|
||||
|
||||
ITextChannel textChannel = guild.TextChannels
|
||||
.FirstOrDefault(t => t.Name == GetChannelName(afterVch.Name).ToLowerInvariant());
|
||||
@ -115,7 +119,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
var created = (await guild.CreateTextChannelAsync(GetChannelName(afterVch.Name).ToLowerInvariant()).ConfigureAwait(false));
|
||||
|
||||
try { await guild.CurrentUser.AddRolesAsync(roleToAdd).ConfigureAwait(false); } catch { }
|
||||
try { await guild.CurrentUser.AddRolesAsync(roleToAdd).ConfigureAwait(false); } catch {/*ignored*/}
|
||||
await Task.Delay(50).ConfigureAwait(false);
|
||||
await created.AddPermissionOverwriteAsync(roleToAdd, new OverwritePermissions(
|
||||
readMessages: PermValue.Allow,
|
||||
@ -162,7 +166,7 @@ namespace NadekoBot.Modules.Administration
|
||||
var botUser = await guild.GetCurrentUserAsync().ConfigureAwait(false);
|
||||
if (!botUser.GuildPermissions.ManageRoles || !botUser.GuildPermissions.ManageChannels)
|
||||
{
|
||||
await Context.Channel.SendErrorAsync("I require atleast **manage roles** and **manage channels permissions** to enable this feature. `(preffered Administration permission)`");
|
||||
await ReplyErrorLocalized("vt_no_perms").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -170,10 +174,12 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
try
|
||||
{
|
||||
await Context.Channel.SendErrorAsync("⚠️ You are enabling/disabling this feature and **I do not have ADMINISTRATOR permissions**. " +
|
||||
"`This may cause some issues, and you will have to clean up text channels yourself afterwards.`");
|
||||
await ReplyErrorLocalized("vt_no_admin").ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
try
|
||||
{
|
||||
@ -198,11 +204,11 @@ namespace NadekoBot.Modules.Administration
|
||||
try { await role.DeleteAsync().ConfigureAwait(false); } catch { }
|
||||
await Task.Delay(500).ConfigureAwait(false);
|
||||
}
|
||||
await Context.Channel.SendConfirmAsync("ℹ️ Successfuly **removed** voice + text feature.").ConfigureAwait(false);
|
||||
await ReplyConfirmLocalized("vt_disabled").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
_voicePlusTextCache.Add(guild.Id);
|
||||
await Context.Channel.SendConfirmAsync("🆗 Successfuly **enabled** voice + text feature.").ConfigureAwait(false);
|
||||
await ReplyConfirmLocalized("vt_enabled").ConfigureAwait(false);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -222,7 +228,7 @@ namespace NadekoBot.Modules.Administration
|
||||
var botUser = await guild.GetCurrentUserAsync().ConfigureAwait(false);
|
||||
if (!botUser.GuildPermissions.Administrator)
|
||||
{
|
||||
await Context.Channel.SendErrorAsync("I need **Administrator permission** to do that.").ConfigureAwait(false);
|
||||
await ReplyErrorLocalized("need_admin").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -249,7 +255,7 @@ namespace NadekoBot.Modules.Administration
|
||||
await Task.Delay(500).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await Context.Channel.SendConfirmAsync("Cleaned v+t.").ConfigureAwait(false);
|
||||
await ReplyConfirmLocalized("cleaned_up").ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
63
src/NadekoBot/Resources/ResponseStrings.Designer.cs
generated
63
src/NadekoBot/Resources/ResponseStrings.Designer.cs
generated
@ -212,6 +212,15 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cleaned up..
|
||||
/// </summary>
|
||||
public static string administration_cleaned_up {
|
||||
get {
|
||||
return ResourceManager.GetString("administration_cleaned_up", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Content.
|
||||
/// </summary>
|
||||
@ -636,6 +645,15 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to I need **Administration** permission to do that..
|
||||
/// </summary>
|
||||
public static string administration_need_admin {
|
||||
get {
|
||||
return ResourceManager.GetString("administration_need_admin", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New Message.
|
||||
/// </summary>
|
||||
@ -1286,6 +1304,51 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Disabled voice + text feature..
|
||||
/// </summary>
|
||||
public static string administration_vt_disabled {
|
||||
get {
|
||||
return ResourceManager.GetString("administration_vt_disabled", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Enabled voice + text feature..
|
||||
/// </summary>
|
||||
public static string administration_vt_enabled {
|
||||
get {
|
||||
return ResourceManager.GetString("administration_vt_enabled", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to I don't have **manage roles** and/or **manage channels** permission, so I cannot run `voice+text` on {0} server..
|
||||
/// </summary>
|
||||
public static string administration_vt_exit {
|
||||
get {
|
||||
return ResourceManager.GetString("administration_vt_exit", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to You are enabling/disabling this feature and **I do not have ADMINISTRATOR permissions**. This may cause some issues, and you will have to clean up text channels yourself afterwards..
|
||||
/// </summary>
|
||||
public static string administration_vt_no_admin {
|
||||
get {
|
||||
return ResourceManager.GetString("administration_vt_no_admin", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to I require atleast **manage roles** and **manage channels** permissions to enable this feature. (preffered Administration permission).
|
||||
/// </summary>
|
||||
public static string administration_vt_perms {
|
||||
get {
|
||||
return ResourceManager.GetString("administration_vt_perms", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User {0} from text chat.
|
||||
/// </summary>
|
||||
|
@ -350,6 +350,9 @@
|
||||
<data name="administration_ch_topic_change" xml:space="preserve">
|
||||
<value>Channel Topic Changed</value>
|
||||
</data>
|
||||
<data name="administration_cleaned_up" xml:space="preserve">
|
||||
<value>Cleaned up.</value>
|
||||
</data>
|
||||
<data name="administration_content" xml:space="preserve">
|
||||
<value>Content</value>
|
||||
</data>
|
||||
@ -494,6 +497,9 @@
|
||||
<data name="administration_mute_role_set" xml:space="preserve">
|
||||
<value>New mute role set.</value>
|
||||
</data>
|
||||
<data name="administration_need_admin" xml:space="preserve">
|
||||
<value>I need **Administration** permission to do that.</value>
|
||||
</data>
|
||||
<data name="administration_new_msg" xml:space="preserve">
|
||||
<value>New Message</value>
|
||||
</data>
|
||||
@ -714,6 +720,21 @@
|
||||
<data name="administration_voice_chan_destroyed" xml:space="preserve">
|
||||
<value>Voice Channel Destroyed</value>
|
||||
</data>
|
||||
<data name="administration_vt_disabled" xml:space="preserve">
|
||||
<value>Disabled voice + text feature.</value>
|
||||
</data>
|
||||
<data name="administration_vt_enabled" xml:space="preserve">
|
||||
<value>Enabled voice + text feature.</value>
|
||||
</data>
|
||||
<data name="administration_vt_exit" xml:space="preserve">
|
||||
<value>I don't have **manage roles** and/or **manage channels** permission, so I cannot run `voice+text` on {0} server.</value>
|
||||
</data>
|
||||
<data name="administration_vt_no_admin" xml:space="preserve">
|
||||
<value>You are enabling/disabling this feature and **I do not have ADMINISTRATOR permissions**. This may cause some issues, and you will have to clean up text channels yourself afterwards.</value>
|
||||
</data>
|
||||
<data name="administration_vt_perms" xml:space="preserve">
|
||||
<value>I require atleast **manage roles** and **manage channels** permissions to enable this feature. (preffered Administration permission)</value>
|
||||
</data>
|
||||
<data name="administration_xmuted_text" xml:space="preserve">
|
||||
<value>User {0} from text chat</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user