localized mute commands

This commit is contained in:
Kwoth 2017-02-14 16:36:02 +01:00
parent f9c9896926
commit 8c27082c14
3 changed files with 110 additions and 14 deletions

View File

@ -156,7 +156,7 @@ namespace NadekoBot.Modules.Administration
guildMuteRoles.AddOrUpdate(Context.Guild.Id, name, (id, old) => name); guildMuteRoles.AddOrUpdate(Context.Guild.Id, name, (id, old) => name);
await uow.CompleteAsync().ConfigureAwait(false); await uow.CompleteAsync().ConfigureAwait(false);
} }
await Context.Channel.SendConfirmAsync("☑️ **New mute role set.**").ConfigureAwait(false); await ReplyConfirmLocalized("mute_role_set").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -174,12 +174,12 @@ namespace NadekoBot.Modules.Administration
{ {
try try
{ {
await MuteUser(user).ConfigureAwait(false); await MuteUser(user).ConfigureAwait(false);
await Context.Channel.SendConfirmAsync($"🔇 **{user}** has been **muted** from text and voice chat.").ConfigureAwait(false); await ReplyConfirmLocalized("user_muted", Format.Bold(user.ToString())).ConfigureAwait(false);
} }
catch catch
{ {
await Context.Channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); await ReplyErrorLocalized("mute_error").ConfigureAwait(false);
} }
} }
@ -192,11 +192,11 @@ namespace NadekoBot.Modules.Administration
try try
{ {
await UnmuteUser(user).ConfigureAwait(false); await UnmuteUser(user).ConfigureAwait(false);
await Context.Channel.SendConfirmAsync($"🔉 **{user}** has been **unmuted** from text and voice chat.").ConfigureAwait(false); await ReplyConfirmLocalized("user_unmuted", Format.Bold(user.ToString())).ConfigureAwait(false);
} }
catch catch
{ {
await Context.Channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); await ReplyErrorLocalized("mute_error").ConfigureAwait(false);
} }
} }
@ -209,11 +209,11 @@ namespace NadekoBot.Modules.Administration
{ {
await user.AddRolesAsync(await GetMuteRole(Context.Guild).ConfigureAwait(false)).ConfigureAwait(false); await user.AddRolesAsync(await GetMuteRole(Context.Guild).ConfigureAwait(false)).ConfigureAwait(false);
UserMuted(user, MuteType.Chat); UserMuted(user, MuteType.Chat);
await Context.Channel.SendConfirmAsync($"✏️🚫 **{user}** has been **muted** from chatting.").ConfigureAwait(false); await ReplyConfirmLocalized("user_chat_mute", Format.Bold(user.ToString())).ConfigureAwait(false);
} }
catch catch
{ {
await Context.Channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); await ReplyErrorLocalized("mute_error").ConfigureAwait(false);
} }
} }
@ -226,11 +226,11 @@ namespace NadekoBot.Modules.Administration
{ {
await user.RemoveRolesAsync(await GetMuteRole(Context.Guild).ConfigureAwait(false)).ConfigureAwait(false); await user.RemoveRolesAsync(await GetMuteRole(Context.Guild).ConfigureAwait(false)).ConfigureAwait(false);
UserUnmuted(user, MuteType.Chat); UserUnmuted(user, MuteType.Chat);
await Context.Channel.SendConfirmAsync($"✏️✅ **{user}** has been **unmuted** from chatting.").ConfigureAwait(false); await ReplyConfirmLocalized("user_chat_unmute", Format.Bold(user.ToString())).ConfigureAwait(false);
} }
catch catch
{ {
await Context.Channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); await ReplyErrorLocalized("mute_error").ConfigureAwait(false);
} }
} }
@ -243,11 +243,11 @@ namespace NadekoBot.Modules.Administration
{ {
await user.ModifyAsync(usr => usr.Mute = true).ConfigureAwait(false); await user.ModifyAsync(usr => usr.Mute = true).ConfigureAwait(false);
UserMuted(user, MuteType.Voice); UserMuted(user, MuteType.Voice);
await Context.Channel.SendConfirmAsync($"🎙🚫 **{user}** has been **voice muted**.").ConfigureAwait(false); await ReplyConfirmLocalized("user_voice_mute", Format.Bold(user.ToString())).ConfigureAwait(false);
} }
catch catch
{ {
await Context.Channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); await ReplyErrorLocalized("mute_error").ConfigureAwait(false);
} }
} }
@ -260,11 +260,11 @@ namespace NadekoBot.Modules.Administration
{ {
await user.ModifyAsync(usr => usr.Mute = false).ConfigureAwait(false); await user.ModifyAsync(usr => usr.Mute = false).ConfigureAwait(false);
UserUnmuted(user, MuteType.Voice); UserUnmuted(user, MuteType.Voice);
await Context.Channel.SendConfirmAsync($"🎙✅ **{user}** has been **voice unmuted**.").ConfigureAwait(false); await ReplyConfirmLocalized("user_voice_unmute", Format.Bold(user.ToString())).ConfigureAwait(false);
} }
catch catch
{ {
await Context.Channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); await ReplyErrorLocalized("mute_error").ConfigureAwait(false);
} }
} }
} }

View File

@ -59,6 +59,78 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to I don&apos;t have the permission necessary for that most likely..
/// </summary>
public static string administration_mute_error {
get {
return ResourceManager.GetString("administration_mute_error", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New mute role set..
/// </summary>
public static string administration_mute_role_set {
get {
return ResourceManager.GetString("administration_mute_role_set", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has been **muted** from chatting..
/// </summary>
public static string administration_user_chat_mute {
get {
return ResourceManager.GetString("administration_user_chat_mute", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has been **unmuted** from chatting..
/// </summary>
public static string administration_user_chat_unmute {
get {
return ResourceManager.GetString("administration_user_chat_unmute", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has been **muted** from text and voice chat..
/// </summary>
public static string administration_user_muted {
get {
return ResourceManager.GetString("administration_user_muted", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has been **unmuted** from text and voice chat..
/// </summary>
public static string administration_user_unmuted {
get {
return ResourceManager.GetString("administration_user_unmuted", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has been **voice muted**..
/// </summary>
public static string administration_user_voice_mute {
get {
return ResourceManager.GetString("administration_user_voice_mute", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has been **voice unmuted**..
/// </summary>
public static string administration_user_voice_unmute {
get {
return ResourceManager.GetString("administration_user_voice_unmute", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to That base is already claimed or destroyed.. /// Looks up a localized string similar to That base is already claimed or destroyed..
/// </summary> /// </summary>

View File

@ -298,6 +298,30 @@
<data name="pokemon_you_fainted" xml:space="preserve"> <data name="pokemon_you_fainted" xml:space="preserve">
<value>You fainted, so you are not able to move!</value> <value>You fainted, so you are not able to move!</value>
</data> </data>
<data name="administration_mute_error" xml:space="preserve">
<value>I don't have the permission necessary for that most likely.</value>
</data>
<data name="administration_mute_role_set" xml:space="preserve">
<value>New mute role set.</value>
</data>
<data name="administration_user_chat_mute" xml:space="preserve">
<value>{0} has been **muted** from chatting.</value>
</data>
<data name="administration_user_chat_unmute" xml:space="preserve">
<value>{0} has been **unmuted** from chatting.</value>
</data>
<data name="administration_user_muted" xml:space="preserve">
<value>{0} has been **muted** from text and voice chat.</value>
</data>
<data name="administration_user_unmuted" xml:space="preserve">
<value>{0} has been **unmuted** from text and voice chat.</value>
</data>
<data name="administration_user_voice_mute" xml:space="preserve">
<value>{0} has been **voice muted**.</value>
</data>
<data name="administration_user_voice_unmute" xml:space="preserve">
<value>{0} has been **voice unmuted**.</value>
</data>
<data name="help_back_to_toc" xml:space="preserve"> <data name="help_back_to_toc" xml:space="preserve">
<value>Back to ToC</value> <value>Back to ToC</value>
</data> </data>