self commands done too

This commit is contained in:
Kwoth 2017-02-14 22:07:28 +01:00
parent fd81b2de26
commit fdc41caed1
3 changed files with 244 additions and 44 deletions

View File

@ -102,14 +102,14 @@ namespace NadekoBot.Modules.Administration
if (shard == null) if (shard == null)
{ {
await Context.Channel.SendErrorAsync("No shard by that id found.").ConfigureAwait(false); await ReplyErrorLocalized("no_shard_id").ConfigureAwait(false);
return; return;
} }
try try
{ {
await Context.Channel.SendConfirmAsync($"Shard **#{shardid}** reconnecting.").ConfigureAwait(false); await ReplyConfirmLocalized("shard_reconnecting", Format.Bold("#" + shardid)).ConfigureAwait(false);
await shard.ConnectAsync().ConfigureAwait(false); await shard.ConnectAsync().ConfigureAwait(false);
await Context.Channel.SendConfirmAsync($"Shard **#{shardid}** reconnected.").ConfigureAwait(false); await ReplyConfirmLocalized("shard_reconnected", Format.Bold("#" + shardid)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -127,18 +127,18 @@ namespace NadekoBot.Modules.Administration
if (server == null) if (server == null)
{ {
await Context.Channel.SendErrorAsync("⚠️ Cannot find that server").ConfigureAwait(false); await ReplyErrorLocalized("no_server").ConfigureAwait(false);
return; return;
} }
if (server.OwnerId != NadekoBot.Client.CurrentUser.Id) if (server.OwnerId != NadekoBot.Client.CurrentUser.Id)
{ {
await server.LeaveAsync().ConfigureAwait(false); await server.LeaveAsync().ConfigureAwait(false);
await Context.Channel.SendConfirmAsync("✅ Left server " + server.Name).ConfigureAwait(false); await ReplyConfirmLocalized("left_server", Format.Bold(server.Name)).ConfigureAwait(false);
} }
else else
{ {
await server.DeleteAsync().ConfigureAwait(false); await server.DeleteAsync().ConfigureAwait(false);
await Context.Channel.SendConfirmAsync("Deleted server " + server.Name).ConfigureAwait(false); await ReplyConfirmLocalized("deleted_server",Format.Bold(server.Name)).ConfigureAwait(false);
} }
} }
@ -147,7 +147,14 @@ namespace NadekoBot.Modules.Administration
[OwnerOnly] [OwnerOnly]
public async Task Die() public async Task Die()
{ {
try { await Context.Channel.SendConfirmAsync(" **Shutting down.**").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); } try
{
await ReplyConfirmLocalized("shutting_down").ConfigureAwait(false);
}
catch
{
// ignored
}
await Task.Delay(2000).ConfigureAwait(false); await Task.Delay(2000).ConfigureAwait(false);
Environment.Exit(0); Environment.Exit(0);
} }
@ -161,7 +168,7 @@ namespace NadekoBot.Modules.Administration
await NadekoBot.Client.CurrentUser.ModifyAsync(u => u.Username = newName).ConfigureAwait(false); await NadekoBot.Client.CurrentUser.ModifyAsync(u => u.Username = newName).ConfigureAwait(false);
await Context.Channel.SendConfirmAsync($"Bot name changed to **{newName}**").ConfigureAwait(false); await ReplyConfirmLocalized("bot_name", Format.Bold(newName)).ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -170,7 +177,7 @@ namespace NadekoBot.Modules.Administration
{ {
await NadekoBot.Client.SetStatusAsync(SettableUserStatusToUserStatus(status)).ConfigureAwait(false); await NadekoBot.Client.SetStatusAsync(SettableUserStatusToUserStatus(status)).ConfigureAwait(false);
await Context.Channel.SendConfirmAsync($"Bot status changed to **{status}**").ConfigureAwait(false); await ReplyConfirmLocalized("bot_status", Format.Bold(status.ToString())).ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -192,7 +199,7 @@ namespace NadekoBot.Modules.Administration
} }
} }
await Context.Channel.SendConfirmAsync("🆒 **New avatar set.**").ConfigureAwait(false); await ReplyConfirmLocalized("set_avatar").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -201,7 +208,7 @@ namespace NadekoBot.Modules.Administration
{ {
await NadekoBot.Client.SetGameAsync(game).ConfigureAwait(false); await NadekoBot.Client.SetGameAsync(game).ConfigureAwait(false);
await Context.Channel.SendConfirmAsync("👾 **New game set.**").ConfigureAwait(false); await ReplyConfirmLocalized("set_game").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -212,7 +219,7 @@ namespace NadekoBot.Modules.Administration
await NadekoBot.Client.SetGameAsync(name, url, StreamType.Twitch).ConfigureAwait(false); await NadekoBot.Client.SetGameAsync(name, url, StreamType.Twitch).ConfigureAwait(false);
await Context.Channel.SendConfirmAsync(" **New stream set.**").ConfigureAwait(false); await ReplyConfirmLocalized("set_stream").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -253,8 +260,10 @@ namespace NadekoBot.Modules.Administration
} }
else else
{ {
await Context.Channel.SendErrorAsync("⚠️ Invalid format.").ConfigureAwait(false); await ReplyErrorLocalized("invalid_format").ConfigureAwait(false);
return;
} }
await ReplyConfirmLocalized("message_sent").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -264,10 +273,10 @@ namespace NadekoBot.Modules.Administration
var channels = NadekoBot.Client.GetGuilds().Select(g => g.DefaultChannel).ToArray(); var channels = NadekoBot.Client.GetGuilds().Select(g => g.DefaultChannel).ToArray();
if (channels == null) if (channels == null)
return; return;
await Task.WhenAll(channels.Where(c => c != null).Select(c => c.SendConfirmAsync($"🆕 Message from {Context.User} `[Bot Owner]`:", message))) await Task.WhenAll(channels.Where(c => c != null).Select(c => c.SendConfirmAsync(GetText("message_from_bo", Context.User.ToString()), message)))
.ConfigureAwait(false); .ConfigureAwait(false);
await Context.Channel.SendConfirmAsync("🆗").ConfigureAwait(false); await ReplyConfirmLocalized("message_sent").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -275,7 +284,7 @@ namespace NadekoBot.Modules.Administration
public async Task ReloadImages() public async Task ReloadImages()
{ {
var time = await NadekoBot.Images.Reload().ConfigureAwait(false); var time = await NadekoBot.Images.Reload().ConfigureAwait(false);
await Context.Channel.SendConfirmAsync($"Images loaded after {time.TotalSeconds:F3}s!").ConfigureAwait(false); await ReplyConfirmLocalized("images_loaded", time.TotalSeconds.ToString("F3")).ConfigureAwait(false);
} }
private static UserStatus SettableUserStatusToUserStatus(SettableUserStatus sus) private static UserStatus SettableUserStatusToUserStatus(SettableUserStatus sus)

View File

@ -59,24 +59,6 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to You already have {0} role..
/// </summary>
public static string administartion_self_assign_already {
get {
return ResourceManager.GetString("administartion_self_assign_already", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You no longer have {0} role..
/// </summary>
public static string administartion_self_assign_remove {
get {
return ResourceManager.GetString("administartion_self_assign_remove", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to **Auto assign role** on user join is now **disabled**.. /// Looks up a localized string similar to **Auto assign role** on user join is now **disabled**..
/// </summary> /// </summary>
@ -122,6 +104,24 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Bot name changed to {0}.
/// </summary>
public static string administration_bot_name {
get {
return ResourceManager.GetString("administration_bot_name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Bot status changed to {0}.
/// </summary>
public static string administration_bot_status {
get {
return ResourceManager.GetString("administration_bot_status", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Channel Name Changed. /// Looks up a localized string similar to Channel Name Changed.
/// </summary> /// </summary>
@ -158,6 +158,15 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Deleted server {0}.
/// </summary>
public static string administration_deleted_server {
get {
return ResourceManager.GetString("administration_deleted_server", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to DM from. /// Looks up a localized string similar to DM from.
/// </summary> /// </summary>
@ -203,6 +212,24 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Images loaded after {0} seconds!.
/// </summary>
public static string administration_images_loaded {
get {
return ResourceManager.GetString("administration_images_loaded", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid input format..
/// </summary>
public static string administration_invalid_format {
get {
return ResourceManager.GetString("administration_invalid_format", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Invalid parameters.. /// Looks up a localized string similar to Invalid parameters..
/// </summary> /// </summary>
@ -285,6 +312,15 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Left server {0}.
/// </summary>
public static string administration_left_server {
get {
return ResourceManager.GetString("administration_left_server", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Logging {0} event in this channel.. /// Looks up a localized string similar to Logging {0} event in this channel..
/// </summary> /// </summary>
@ -348,6 +384,24 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Message from {0} `[Bot Owner]`:.
/// </summary>
public static string administration_message_from_bo {
get {
return ResourceManager.GetString("administration_message_from_bo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Message sent..
/// </summary>
public static string administration_message_sent {
get {
return ResourceManager.GetString("administration_message_sent", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to {0} moved from {1} to {2}. /// Looks up a localized string similar to {0} moved from {1} to {2}.
/// </summary> /// </summary>
@ -447,6 +501,24 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Can&apos;t find that server.
/// </summary>
public static string administration_no_server {
get {
return ResourceManager.GetString("administration_no_server", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No shard with that ID found..
/// </summary>
public static string administration_no_shard_id {
get {
return ResourceManager.GetString("administration_no_shard_id", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Old Message. /// Looks up a localized string similar to Old Message.
/// </summary> /// </summary>
@ -628,6 +700,15 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to You already have {0} role..
/// </summary>
public static string administration_self_assign_already {
get {
return ResourceManager.GetString("administration_self_assign_already", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to You already have {0} exclusive self-assigned role.. /// Looks up a localized string similar to You already have {0} exclusive self-assigned role..
/// </summary> /// </summary>
@ -700,6 +781,15 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to You no longer have {0} role..
/// </summary>
public static string administration_self_assign_remove {
get {
return ResourceManager.GetString("administration_self_assign_remove", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to You now have {0} role.. /// Looks up a localized string similar to You now have {0} role..
/// </summary> /// </summary>
@ -709,6 +799,60 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to New avatar set!.
/// </summary>
public static string administration_set_avatar {
get {
return ResourceManager.GetString("administration_set_avatar", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New game set!.
/// </summary>
public static string administration_set_game {
get {
return ResourceManager.GetString("administration_set_game", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New stream set!.
/// </summary>
public static string administration_set_stream {
get {
return ResourceManager.GetString("administration_set_stream", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Shard {0} reconnected..
/// </summary>
public static string administration_shard_reconnected {
get {
return ResourceManager.GetString("administration_shard_reconnected", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Shard {0} reconnecting..
/// </summary>
public static string administration_shard_reconnecting {
get {
return ResourceManager.GetString("administration_shard_reconnecting", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Shutting down.
/// </summary>
public static string administration_shutting_down {
get {
return ResourceManager.GetString("administration_shutting_down", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Users can&apos;t send more than {0} messages every {1} seconds.. /// Looks up a localized string similar to Users can&apos;t send more than {0} messages every {1} seconds..
/// </summary> /// </summary>

View File

@ -298,12 +298,6 @@
<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="administartion_self_assign_already" xml:space="preserve">
<value>You already have {0} role.</value>
</data>
<data name="administartion_self_assign_remove" xml:space="preserve">
<value>You no longer have {0} role.</value>
</data>
<data name="administration_aar_disabled" xml:space="preserve"> <data name="administration_aar_disabled" xml:space="preserve">
<value>**Auto assign role** on user join is now **disabled**.</value> <value>**Auto assign role** on user join is now **disabled**.</value>
</data> </data>
@ -320,6 +314,12 @@
<value>banned</value> <value>banned</value>
<comment>PLURAL</comment> <comment>PLURAL</comment>
</data> </data>
<data name="administration_bot_name" xml:space="preserve">
<value>Bot name changed to {0}</value>
</data>
<data name="administration_bot_status" xml:space="preserve">
<value>Bot status changed to {0}</value>
</data>
<data name="administration_ch_name_change" xml:space="preserve"> <data name="administration_ch_name_change" xml:space="preserve">
<value>Channel Name Changed</value> <value>Channel Name Changed</value>
</data> </data>
@ -332,6 +332,9 @@
<data name="administration_content" xml:space="preserve"> <data name="administration_content" xml:space="preserve">
<value>Content</value> <value>Content</value>
</data> </data>
<data name="administration_deleted_server" xml:space="preserve">
<value>Deleted server {0}</value>
</data>
<data name="administration_dm_from" xml:space="preserve"> <data name="administration_dm_from" xml:space="preserve">
<value>DM from</value> <value>DM from</value>
</data> </data>
@ -347,6 +350,12 @@
<data name="administration_fwdm_stop" xml:space="preserve"> <data name="administration_fwdm_stop" xml:space="preserve">
<value>I will stop forwarding DMs from now on.</value> <value>I will stop forwarding DMs from now on.</value>
</data> </data>
<data name="administration_images_loaded" xml:space="preserve">
<value>Images loaded after {0} seconds!</value>
</data>
<data name="administration_invalid_format" xml:space="preserve">
<value>Invalid input format.</value>
</data>
<data name="administration_invalid_params" xml:space="preserve"> <data name="administration_invalid_params" xml:space="preserve">
<value>Invalid parameters.</value> <value>Invalid parameters.</value>
</data> </data>
@ -375,6 +384,9 @@
<data name="administration_left" xml:space="preserve"> <data name="administration_left" xml:space="preserve">
<value>{0} has left {1}</value> <value>{0} has left {1}</value>
</data> </data>
<data name="administration_left_server" xml:space="preserve">
<value>Left server {0}</value>
</data>
<data name="administration_log" xml:space="preserve"> <data name="administration_log" xml:space="preserve">
<value>Logging {0} event in this channel.</value> <value>Logging {0} event in this channel.</value>
</data> </data>
@ -396,6 +408,12 @@
<data name="administration_log_stop" xml:space="preserve"> <data name="administration_log_stop" xml:space="preserve">
<value>Stopped logging {0} event.</value> <value>Stopped logging {0} event.</value>
</data> </data>
<data name="administration_message_from_bo" xml:space="preserve">
<value>Message from {0} `[Bot Owner]`:</value>
</data>
<data name="administration_message_sent" xml:space="preserve">
<value>Message sent.</value>
</data>
<data name="administration_moved" xml:space="preserve"> <data name="administration_moved" xml:space="preserve">
<value>{0} moved from {1} to {2}</value> <value>{0} moved from {1} to {2}</value>
</data> </data>
@ -431,6 +449,12 @@
<data name="administration_nick_change" xml:space="preserve"> <data name="administration_nick_change" xml:space="preserve">
<value>Nickname Changed</value> <value>Nickname Changed</value>
</data> </data>
<data name="administration_no_server" xml:space="preserve">
<value>Can't find that server</value>
</data>
<data name="administration_no_shard_id" xml:space="preserve">
<value>No shard with that ID found.</value>
</data>
<data name="administration_old_msg" xml:space="preserve"> <data name="administration_old_msg" xml:space="preserve">
<value>Old Message</value> <value>Old Message</value>
</data> </data>
@ -468,7 +492,7 @@
<value>Removed the playing message: {0}</value> <value>Removed the playing message: {0}</value>
</data> </data>
<data name="administration_role_added" xml:space="preserve"> <data name="administration_role_added" xml:space="preserve">
<value>Role {0} is added to the list.</value> <value>Role {0} as been added to the list.</value>
</data> </data>
<data name="administration_role_clean" xml:space="preserve"> <data name="administration_role_clean" xml:space="preserve">
<value>{0} not found.Cleaned up.</value> <value>{0} not found.Cleaned up.</value>
@ -492,6 +516,9 @@
<data name="administration_ropl_not_set" xml:space="preserve"> <data name="administration_ropl_not_set" xml:space="preserve">
<value>No rotating playing statuses set.</value> <value>No rotating playing statuses set.</value>
</data> </data>
<data name="administration_self_assign_already" xml:space="preserve">
<value>You already have {0} role.</value>
</data>
<data name="administration_self_assign_already_excl" xml:space="preserve"> <data name="administration_self_assign_already_excl" xml:space="preserve">
<value>You already have {0} exclusive self-assigned role.</value> <value>You already have {0} exclusive self-assigned role.</value>
</data> </data>
@ -499,8 +526,7 @@
<value>Self assigned roles are now exclusive!</value> <value>Self assigned roles are now exclusive!</value>
</data> </data>
<data name="administration_self_assign_list" xml:space="preserve"> <data name="administration_self_assign_list" xml:space="preserve">
<value>There are {0} self assignable roles: <value>There are {0} self assignable roles</value>
{1}</value>
</data> </data>
<data name="administration_self_assign_not" xml:space="preserve"> <data name="administration_self_assign_not" xml:space="preserve">
<value>That role is not self-assignable.</value> <value>That role is not self-assignable.</value>
@ -517,9 +543,30 @@
<data name="administration_self_assign_rem" xml:space="preserve"> <data name="administration_self_assign_rem" xml:space="preserve">
<value>{0} has been removed from the list of self-assignable roles.</value> <value>{0} has been removed from the list of self-assignable roles.</value>
</data> </data>
<data name="administration_self_assign_sucsess" xml:space="preserve"> <data name="administration_self_assign_remove" xml:space="preserve">
<value>You no longer have {0} role.</value>
</data>
<data name="administration_self_assign_sucess" xml:space="preserve">
<value>You now have {0} role.</value> <value>You now have {0} role.</value>
</data> </data>
<data name="administration_set_avatar" xml:space="preserve">
<value>New avatar set!</value>
</data>
<data name="administration_set_game" xml:space="preserve">
<value>New game set!</value>
</data>
<data name="administration_set_stream" xml:space="preserve">
<value>New stream set!</value>
</data>
<data name="administration_shard_reconnected" xml:space="preserve">
<value>Shard {0} reconnected.</value>
</data>
<data name="administration_shard_reconnecting" xml:space="preserve">
<value>Shard {0} reconnecting.</value>
</data>
<data name="administration_shutting_down" xml:space="preserve">
<value>Shutting down</value>
</data>
<data name="administration_slowmode_desc" xml:space="preserve"> <data name="administration_slowmode_desc" xml:space="preserve">
<value>Users can't send more than {0} messages every {1} seconds.</value> <value>Users can't send more than {0} messages every {1} seconds.</value>
</data> </data>