diff --git a/Boyfriend/Commands/MuteCommand.cs b/Boyfriend/Commands/MuteCommand.cs
index 7e9fb13..7dd8aef 100644
--- a/Boyfriend/Commands/MuteCommand.cs
+++ b/Boyfriend/Commands/MuteCommand.cs
@@ -17,11 +17,12 @@ public class MuteCommand : Command {
if (duration.TotalSeconds < 0) {
Warn(Messages.DurationParseFailed);
reason = Utils.JoinString(ref args, 1);
+ }
- if (reason is "") {
- Error(Messages.ReasonRequired, false);
- return;
- }
+
+ if (reason is "") {
+ Error(Messages.ReasonRequired, false);
+ return;
}
if (toMute == null) {
@@ -65,10 +66,6 @@ public class MuteCommand : Command {
}
await MuteMember(guild, author, toMute, duration, reason);
-
- Success(
- string.Format(Messages.FeedbackMemberMuted, toMute.Mention, Utils.GetHumanizedTimeOffset(ref duration),
- Utils.Wrap(reason)), author.Mention, true);
}
private static async Task MuteMember(SocketGuild guild, SocketUser author, SocketGuildUser toMute,
@@ -86,8 +83,7 @@ public class MuteCommand : Command {
if (userRole == guild.EveryoneRole || userRole == role) continue;
await toMute.RemoveRoleAsync(role);
rolesRemoved.Add(userRole.Id);
- }
- catch (HttpException e) {
+ } catch (HttpException e) {
Warn(string.Format(Messages.RoleRemovalFailed, $"<@&{userRole}>", Utils.Wrap(e.Reason)));
}
@@ -105,9 +101,8 @@ public class MuteCommand : Command {
}
await toMute.AddRoleAsync(role, requestOptions);
- }
- else {
- if (!hasDuration) {
+ } else {
+ if (!hasDuration || duration.TotalDays > 28) {
Error(Messages.DurationRequiredForTimeOuts, false);
return;
}
@@ -119,5 +114,11 @@ public class MuteCommand : Command {
await toMute.SetTimeOutAsync(duration, requestOptions);
}
+
+ var feedback = string.Format(Messages.FeedbackMemberMuted, toMute.Mention,
+ Utils.GetHumanizedTimeOffset(ref duration),
+ Utils.Wrap(reason));
+ Success(feedback, author.Mention, false, false);
+ await Utils.SendFeedback(feedback, guild.Id, author.Mention, true);
}
-}
\ No newline at end of file
+}
diff --git a/Boyfriend/Messages.Designer.cs b/Boyfriend/Messages.Designer.cs
index 08276fc..3b588bf 100644
--- a/Boyfriend/Messages.Designer.cs
+++ b/Boyfriend/Messages.Designer.cs
@@ -11,32 +11,46 @@ namespace Boyfriend {
using System;
- [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Messages {
- private static System.Resources.ResourceManager resourceMan;
+ private static global::System.Resources.ResourceManager resourceMan;
- private static System.Globalization.CultureInfo resourceCulture;
+ private static global::System.Globalization.CultureInfo resourceCulture;
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Messages() {
}
- [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static System.Resources.ResourceManager ResourceManager {
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
get {
- if (object.Equals(null, resourceMan)) {
- System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Boyfriend.Messages", typeof(Messages).Assembly);
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Boyfriend.Messages", typeof(Messages).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
- [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static System.Globalization.CultureInfo Culture {
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@@ -45,556 +59,832 @@ namespace Boyfriend {
}
}
- internal static string CouldntFindGuildByChannel {
- get {
- return ResourceManager.GetString("CouldntFindGuildByChannel", resourceCulture);
- }
- }
-
- internal static string Ready {
- get {
- return ResourceManager.GetString("Ready", resourceCulture);
- }
- }
-
- internal static string UncachedMessageDeleted {
- get {
- return ResourceManager.GetString("UncachedMessageDeleted", resourceCulture);
- }
- }
-
- internal static string CachedMessageDeleted {
- get {
- return ResourceManager.GetString("CachedMessageDeleted", resourceCulture);
- }
- }
-
+ ///
+ /// Looks up a localized string similar to Too many mentions in 1 message.
+ ///
internal static string AutobanReason {
get {
return ResourceManager.GetString("AutobanReason", resourceCulture);
}
}
- internal static string UncachedMessageEdited {
- get {
- return ResourceManager.GetString("UncachedMessageEdited", resourceCulture);
- }
- }
-
- internal static string CachedMessageEdited {
- get {
- return ResourceManager.GetString("CachedMessageEdited", resourceCulture);
- }
- }
-
- internal static string DefaultWelcomeMessage {
- get {
- return ResourceManager.GetString("DefaultWelcomeMessage", resourceCulture);
- }
- }
-
+ ///
+ /// Looks up a localized string similar to Bah! .
+ ///
internal static string Beep1 {
get {
return ResourceManager.GetString("Beep1", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Bop! .
+ ///
internal static string Beep2 {
get {
return ResourceManager.GetString("Beep2", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Beep! .
+ ///
internal static string Beep3 {
get {
return ResourceManager.GetString("Beep3", resourceCulture);
}
}
- internal static string CommandNoPermissionBot {
+ ///
+ /// Looks up a localized string similar to Deleted message from {0} in channel {1}: {2}.
+ ///
+ internal static string CachedMessageDeleted {
get {
- return ResourceManager.GetString("CommandNoPermissionBot", resourceCulture);
+ return ResourceManager.GetString("CachedMessageDeleted", resourceCulture);
}
}
- internal static string CommandNoPermissionUser {
+ ///
+ /// Looks up a localized string similar to Edited message in channel {0}: {1} -> {2}.
+ ///
+ internal static string CachedMessageEdited {
get {
- return ResourceManager.GetString("CommandNoPermissionUser", resourceCulture);
- }
- }
-
- internal static string InteractionsDifferentGuilds {
- get {
- return ResourceManager.GetString("InteractionsDifferentGuilds", resourceCulture);
- }
- }
-
- internal static string InteractionsOwner {
- get {
- return ResourceManager.GetString("InteractionsOwner", resourceCulture);
- }
- }
-
- internal static string InteractionsYourself {
- get {
- return ResourceManager.GetString("InteractionsYourself", resourceCulture);
- }
- }
-
- internal static string InteractionsMe {
- get {
- return ResourceManager.GetString("InteractionsMe", resourceCulture);
- }
- }
-
- internal static string InteractionsFailedUser {
- get {
- return ResourceManager.GetString("InteractionsFailedUser", resourceCulture);
- }
- }
-
- internal static string InteractionsFailedBot {
- get {
- return ResourceManager.GetString("InteractionsFailedBot", resourceCulture);
- }
- }
-
- internal static string YouWereBanned {
- get {
- return ResourceManager.GetString("YouWereBanned", resourceCulture);
- }
- }
-
- internal static string PunishmentExpired {
- get {
- return ResourceManager.GetString("PunishmentExpired", resourceCulture);
- }
- }
-
- internal static string ClearNegativeAmount {
- get {
- return ResourceManager.GetString("ClearNegativeAmount", resourceCulture);
- }
- }
-
- internal static string ClearAmountTooLarge {
- get {
- return ResourceManager.GetString("ClearAmountTooLarge", resourceCulture);
- }
- }
-
- internal static string CommandHelp {
- get {
- return ResourceManager.GetString("CommandHelp", resourceCulture);
- }
- }
-
- internal static string YouWereKicked {
- get {
- return ResourceManager.GetString("YouWereKicked", resourceCulture);
- }
- }
-
- internal static string Milliseconds {
- get {
- return ResourceManager.GetString("Milliseconds", resourceCulture);
- }
- }
-
- internal static string MemberAlreadyMuted {
- get {
- return ResourceManager.GetString("MemberAlreadyMuted", resourceCulture);
- }
- }
-
- internal static string ChannelNotSpecified {
- get {
- return ResourceManager.GetString("ChannelNotSpecified", resourceCulture);
- }
- }
-
- internal static string RoleNotSpecified {
- get {
- return ResourceManager.GetString("RoleNotSpecified", resourceCulture);
- }
- }
-
- internal static string CurrentSettings {
- get {
- return ResourceManager.GetString("CurrentSettings", resourceCulture);
- }
- }
-
- internal static string SettingsLang {
- get {
- return ResourceManager.GetString("SettingsLang", resourceCulture);
- }
- }
-
- internal static string SettingsPrefix {
- get {
- return ResourceManager.GetString("SettingsPrefix", resourceCulture);
- }
- }
-
- internal static string SettingsRemoveRolesOnMute {
- get {
- return ResourceManager.GetString("SettingsRemoveRolesOnMute", resourceCulture);
- }
- }
-
- internal static string SettingsSendWelcomeMessages {
- get {
- return ResourceManager.GetString("SettingsSendWelcomeMessages", resourceCulture);
- }
- }
-
- internal static string SettingsStarterRole {
- get {
- return ResourceManager.GetString("SettingsStarterRole", resourceCulture);
- }
- }
-
- internal static string SettingsMuteRole {
- get {
- return ResourceManager.GetString("SettingsMuteRole", resourceCulture);
- }
- }
-
- internal static string SettingsAdminLogChannel {
- get {
- return ResourceManager.GetString("SettingsAdminLogChannel", resourceCulture);
- }
- }
-
- internal static string SettingsBotLogChannel {
- get {
- return ResourceManager.GetString("SettingsBotLogChannel", resourceCulture);
- }
- }
-
- internal static string LanguageNotSupported {
- get {
- return ResourceManager.GetString("LanguageNotSupported", resourceCulture);
- }
- }
-
- internal static string Yes {
- get {
- return ResourceManager.GetString("Yes", resourceCulture);
- }
- }
-
- internal static string No {
- get {
- return ResourceManager.GetString("No", resourceCulture);
- }
- }
-
- internal static string UserNotBanned {
- get {
- return ResourceManager.GetString("UserNotBanned", resourceCulture);
- }
- }
-
- internal static string MemberNotMuted {
- get {
- return ResourceManager.GetString("MemberNotMuted", resourceCulture);
- }
- }
-
- internal static string RolesReturned {
- get {
- return ResourceManager.GetString("RolesReturned", resourceCulture);
- }
- }
-
- internal static string MemberUnmuted {
- get {
- return ResourceManager.GetString("MemberUnmuted", resourceCulture);
- }
- }
-
- internal static string UserUnbanned {
- get {
- return ResourceManager.GetString("UserUnbanned", resourceCulture);
- }
- }
-
- internal static string SettingsWelcomeMessage {
- get {
- return ResourceManager.GetString("SettingsWelcomeMessage", resourceCulture);
- }
- }
-
- internal static string NotEnoughArguments {
- get {
- return ResourceManager.GetString("NotEnoughArguments", resourceCulture);
- }
- }
-
- internal static string ClearInvalidAmountSpecified {
- get {
- return ResourceManager.GetString("ClearInvalidAmountSpecified", resourceCulture);
- }
- }
-
- internal static string FeedbackUserBanned {
- get {
- return ResourceManager.GetString("FeedbackUserBanned", resourceCulture);
- }
- }
-
- internal static string UserNotInGuild {
- get {
- return ResourceManager.GetString("UserNotInGuild", resourceCulture);
- }
- }
-
- internal static string SettingDoesntExist {
- get {
- return ResourceManager.GetString("SettingDoesntExist", resourceCulture);
- }
- }
-
- internal static string SettingsReceiveStartupMessages {
- get {
- return ResourceManager.GetString("SettingsReceiveStartupMessages", resourceCulture);
- }
- }
-
- internal static string InvalidSettingValue {
- get {
- return ResourceManager.GetString("InvalidSettingValue", resourceCulture);
- }
- }
-
- internal static string InvalidRole {
- get {
- return ResourceManager.GetString("InvalidRole", resourceCulture);
- }
- }
-
- internal static string InvalidChannel {
- get {
- return ResourceManager.GetString("InvalidChannel", resourceCulture);
- }
- }
-
- internal static string DurationParseFailed {
- get {
- return ResourceManager.GetString("DurationParseFailed", resourceCulture);
- }
- }
-
- internal static string RoleRemovalFailed {
- get {
- return ResourceManager.GetString("RoleRemovalFailed", resourceCulture);
- }
- }
-
- internal static string DurationRequiredForTimeOuts {
- get {
- return ResourceManager.GetString("DurationRequiredForTimeOuts", resourceCulture);
+ return ResourceManager.GetString("CachedMessageEdited", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to I cannot use time-outs on other bots! Try to set a mute role in settings.
+ ///
internal static string CannotTimeOutBot {
get {
return ResourceManager.GetString("CannotTimeOutBot", resourceCulture);
}
}
- internal static string EventCreated {
+ ///
+ /// Looks up a localized string similar to Not specified.
+ ///
+ internal static string ChannelNotSpecified {
get {
- return ResourceManager.GetString("EventCreated", resourceCulture);
+ return ResourceManager.GetString("ChannelNotSpecified", resourceCulture);
}
}
- internal static string SettingsEventNotifyReceiverRole {
+ ///
+ /// Looks up a localized string similar to Too many messages specified!.
+ ///
+ internal static string ClearAmountTooLarge {
get {
- return ResourceManager.GetString("SettingsEventNotifyReceiverRole", resourceCulture);
+ return ResourceManager.GetString("ClearAmountTooLarge", resourceCulture);
}
}
- internal static string SettingsEventCreatedChannel {
+ ///
+ /// Looks up a localized string similar to Invalid message amount specified!.
+ ///
+ internal static string ClearInvalidAmountSpecified {
get {
- return ResourceManager.GetString("SettingsEventCreatedChannel", resourceCulture);
+ return ResourceManager.GetString("ClearInvalidAmountSpecified", resourceCulture);
}
}
- internal static string SettingsEventStartedChannel {
+ ///
+ /// Looks up a localized string similar to Negative message amount specified!.
+ ///
+ internal static string ClearNegativeAmount {
get {
- return ResourceManager.GetString("SettingsEventStartedChannel", resourceCulture);
- }
- }
-
- internal static string SettingsEventStartedReceivers {
- get {
- return ResourceManager.GetString("SettingsEventStartedReceivers", resourceCulture);
- }
- }
-
- internal static string EventStarted {
- get {
- return ResourceManager.GetString("EventStarted", resourceCulture);
- }
- }
-
- internal static string SettingsFrowningFace {
- get {
- return ResourceManager.GetString("SettingsFrowningFace", resourceCulture);
- }
- }
-
- internal static string EventCancelled {
- get {
- return ResourceManager.GetString("EventCancelled", resourceCulture);
- }
- }
-
- internal static string SettingsEventCancelledChannel {
- get {
- return ResourceManager.GetString("SettingsEventCancelledChannel", resourceCulture);
- }
- }
-
- internal static string SettingsEventCompletedChannel {
- get {
- return ResourceManager.GetString("SettingsEventCompletedChannel", resourceCulture);
- }
- }
-
- internal static string EventCompleted {
- get {
- return ResourceManager.GetString("EventCompleted", resourceCulture);
- }
- }
-
- internal static string UserDoesntExist {
- get {
- return ResourceManager.GetString("UserDoesntExist", resourceCulture);
- }
- }
-
- internal static string FeedbackFormat {
- get {
- return ResourceManager.GetString("FeedbackFormat", resourceCulture);
- }
- }
-
- internal static string Ever {
- get {
- return ResourceManager.GetString("Ever", resourceCulture);
- }
- }
-
- internal static string FeedbackMessagesCleared {
- get {
- return ResourceManager.GetString("FeedbackMessagesCleared", resourceCulture);
- }
- }
-
- internal static string FeedbackMemberKicked {
- get {
- return ResourceManager.GetString("FeedbackMemberKicked", resourceCulture);
- }
- }
-
- internal static string FeedbackMemberMuted {
- get {
- return ResourceManager.GetString("FeedbackMemberMuted", resourceCulture);
- }
- }
-
- internal static string FeedbackUserUnbanned {
- get {
- return ResourceManager.GetString("FeedbackUserUnbanned", resourceCulture);
- }
- }
-
- internal static string FeedbackMemberUnmuted {
- get {
- return ResourceManager.GetString("FeedbackMemberUnmuted", resourceCulture);
- }
- }
-
- internal static string SettingsNothingChanged {
- get {
- return ResourceManager.GetString("SettingsNothingChanged", resourceCulture);
- }
- }
-
- internal static string SettingNotDefined {
- get {
- return ResourceManager.GetString("SettingNotDefined", resourceCulture);
- }
- }
-
- internal static string FeedbackSettingsUpdated {
- get {
- return ResourceManager.GetString("FeedbackSettingsUpdated", resourceCulture);
+ return ResourceManager.GetString("ClearNegativeAmount", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Bans a user.
+ ///
internal static string CommandDescriptionBan {
get {
return ResourceManager.GetString("CommandDescriptionBan", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Deletes a specified amount of messages in this channel.
+ ///
internal static string CommandDescriptionClear {
get {
return ResourceManager.GetString("CommandDescriptionClear", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Shows this message.
+ ///
internal static string CommandDescriptionHelp {
get {
return ResourceManager.GetString("CommandDescriptionHelp", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Kicks a member.
+ ///
internal static string CommandDescriptionKick {
get {
return ResourceManager.GetString("CommandDescriptionKick", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Mutes a member.
+ ///
internal static string CommandDescriptionMute {
get {
return ResourceManager.GetString("CommandDescriptionMute", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Shows latency to Discord servers (not counting local processing time).
+ ///
internal static string CommandDescriptionPing {
get {
return ResourceManager.GetString("CommandDescriptionPing", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Allows you to change certain preferences for this guild.
+ ///
internal static string CommandDescriptionSettings {
get {
return ResourceManager.GetString("CommandDescriptionSettings", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Unbans a user.
+ ///
internal static string CommandDescriptionUnban {
get {
return ResourceManager.GetString("CommandDescriptionUnban", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Unmutes a member.
+ ///
internal static string CommandDescriptionUnmute {
get {
return ResourceManager.GetString("CommandDescriptionUnmute", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to Command help:.
+ ///
+ internal static string CommandHelp {
+ get {
+ return ResourceManager.GetString("CommandHelp", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to I do not have permission to execute this command!.
+ ///
+ internal static string CommandNoPermissionBot {
+ get {
+ return ResourceManager.GetString("CommandNoPermissionBot", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You do not have permission to execute this command!.
+ ///
+ internal static string CommandNoPermissionUser {
+ get {
+ return ResourceManager.GetString("CommandNoPermissionUser", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Couldn't find guild by message!.
+ ///
+ internal static string CouldntFindGuildByChannel {
+ get {
+ return ResourceManager.GetString("CouldntFindGuildByChannel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Current settings:.
+ ///
+ internal static string CurrentSettings {
+ get {
+ return ResourceManager.GetString("CurrentSettings", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0}, welcome to {1}.
+ ///
+ internal static string DefaultWelcomeMessage {
+ get {
+ return ResourceManager.GetString("DefaultWelcomeMessage", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to I couldn't parse the specified duration! One of the components could be outside it's valid range (e.g. `24h` or `60m`).
+ ///
+ internal static string DurationParseFailed {
+ get {
+ return ResourceManager.GetString("DurationParseFailed", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to I cannot mute someone for more than 28 days using timeouts! Either specify a duration shorter than 28 days, or set a mute role in settings.
+ ///
+ internal static string DurationRequiredForTimeOuts {
+ get {
+ return ResourceManager.GetString("DurationRequiredForTimeOuts", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Event {0} is cancelled!{1}.
+ ///
+ internal static string EventCancelled {
+ get {
+ return ResourceManager.GetString("EventCancelled", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Event {0} has completed! Duration: {1}.
+ ///
+ internal static string EventCompleted {
+ get {
+ return ResourceManager.GetString("EventCompleted", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {1}{2} created event {3}! It will take place in {4} and will start <t:{5}:R>!{0}{6}.
+ ///
+ internal static string EventCreated {
+ get {
+ return ResourceManager.GetString("EventCreated", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0}Event {1} is starting at {2}!.
+ ///
+ internal static string EventStarted {
+ get {
+ return ResourceManager.GetString("EventStarted", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to ever.
+ ///
+ internal static string Ever {
+ get {
+ return ResourceManager.GetString("Ever", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to *[{0}: {1}]*.
+ ///
+ internal static string FeedbackFormat {
+ get {
+ return ResourceManager.GetString("FeedbackFormat", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Kicked {0}: {1}.
+ ///
+ internal static string FeedbackMemberKicked {
+ get {
+ return ResourceManager.GetString("FeedbackMemberKicked", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Muted {0} for{1}: {2}.
+ ///
+ internal static string FeedbackMemberMuted {
+ get {
+ return ResourceManager.GetString("FeedbackMemberMuted", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Unmuted {0}: {1}.
+ ///
+ internal static string FeedbackMemberUnmuted {
+ get {
+ return ResourceManager.GetString("FeedbackMemberUnmuted", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Deleted {0} messages in {1}.
+ ///
+ internal static string FeedbackMessagesCleared {
+ get {
+ return ResourceManager.GetString("FeedbackMessagesCleared", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Value of setting `{0}` is now set to {1}.
+ ///
+ internal static string FeedbackSettingsUpdated {
+ get {
+ return ResourceManager.GetString("FeedbackSettingsUpdated", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Banned {0} for{1}: {2}.
+ ///
+ internal static string FeedbackUserBanned {
+ get {
+ return ResourceManager.GetString("FeedbackUserBanned", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Unbanned {0}: {1}.
+ ///
+ internal static string FeedbackUserUnbanned {
+ get {
+ return ResourceManager.GetString("FeedbackUserUnbanned", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Members are in different guilds!.
+ ///
+ internal static string InteractionsDifferentGuilds {
+ get {
+ return ResourceManager.GetString("InteractionsDifferentGuilds", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to I cannot interact with this member!.
+ ///
+ internal static string InteractionsFailedBot {
+ get {
+ return ResourceManager.GetString("InteractionsFailedBot", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You cannot interact with this member!.
+ ///
+ internal static string InteractionsFailedUser {
+ get {
+ return ResourceManager.GetString("InteractionsFailedUser", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You cannot interact with me!.
+ ///
+ internal static string InteractionsMe {
+ get {
+ return ResourceManager.GetString("InteractionsMe", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You cannot interact with guild owner!.
+ ///
+ internal static string InteractionsOwner {
+ get {
+ return ResourceManager.GetString("InteractionsOwner", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You cannot interact with yourself!.
+ ///
+ internal static string InteractionsYourself {
+ get {
+ return ResourceManager.GetString("InteractionsYourself", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to This channel does not exist!.
+ ///
+ internal static string InvalidChannel {
+ get {
+ return ResourceManager.GetString("InvalidChannel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to This role does not exist!.
+ ///
+ internal static string InvalidRole {
+ get {
+ return ResourceManager.GetString("InvalidRole", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Invalid setting value specified!.
+ ///
+ internal static string InvalidSettingValue {
+ get {
+ return ResourceManager.GetString("InvalidSettingValue", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Language not supported!.
+ ///
+ internal static string LanguageNotSupported {
+ get {
+ return ResourceManager.GetString("LanguageNotSupported", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Member is already muted!.
+ ///
+ internal static string MemberAlreadyMuted {
+ get {
+ return ResourceManager.GetString("MemberAlreadyMuted", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Member not muted!.
+ ///
+ internal static string MemberNotMuted {
+ get {
+ return ResourceManager.GetString("MemberNotMuted", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0} unmuted {1} for {2}.
+ ///
+ internal static string MemberUnmuted {
+ get {
+ return ResourceManager.GetString("MemberUnmuted", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to ms.
+ ///
+ internal static string Milliseconds {
+ get {
+ return ResourceManager.GetString("Milliseconds", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to No.
+ ///
+ internal static string No {
+ get {
+ return ResourceManager.GetString("No", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Not enough arguments! Needed: {0}, provided: {1}.
+ ///
+ internal static string NotEnoughArguments {
+ get {
+ return ResourceManager.GetString("NotEnoughArguments", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Punishment expired.
+ ///
+ internal static string PunishmentExpired {
+ get {
+ return ResourceManager.GetString("PunishmentExpired", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0}I'm ready! (C#).
+ ///
+ internal static string Ready {
+ get {
+ return ResourceManager.GetString("Ready", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You must specify a reason!.
+ ///
internal static string ReasonRequired {
get {
return ResourceManager.GetString("ReasonRequired", resourceCulture);
}
}
+
+ ///
+ /// Looks up a localized string similar to Not specified.
+ ///
+ internal static string RoleNotSpecified {
+ get {
+ return ResourceManager.GetString("RoleNotSpecified", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to I couldn't remove role {0} because of an error! {1}.
+ ///
+ internal static string RoleRemovalFailed {
+ get {
+ return ResourceManager.GetString("RoleRemovalFailed", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Someone removed the mute role manually! I added back all roles that I removed during the mute.
+ ///
+ internal static string RolesReturned {
+ get {
+ return ResourceManager.GetString("RolesReturned", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to That setting doesn't exist!.
+ ///
+ internal static string SettingDoesntExist {
+ get {
+ return ResourceManager.GetString("SettingDoesntExist", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Not specified.
+ ///
+ internal static string SettingNotDefined {
+ get {
+ return ResourceManager.GetString("SettingNotDefined", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Admin log channel.
+ ///
+ internal static string SettingsAdminLogChannel {
+ get {
+ return ResourceManager.GetString("SettingsAdminLogChannel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Bot log channel.
+ ///
+ internal static string SettingsBotLogChannel {
+ get {
+ return ResourceManager.GetString("SettingsBotLogChannel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Channel for event cancellation notifications.
+ ///
+ internal static string SettingsEventCancelledChannel {
+ get {
+ return ResourceManager.GetString("SettingsEventCancelledChannel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Channel for event completion notifications.
+ ///
+ internal static string SettingsEventCompletedChannel {
+ get {
+ return ResourceManager.GetString("SettingsEventCompletedChannel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Channel for event creation notifications.
+ ///
+ internal static string SettingsEventCreatedChannel {
+ get {
+ return ResourceManager.GetString("SettingsEventCreatedChannel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Role for event creation notifications.
+ ///
+ internal static string SettingsEventNotifyReceiverRole {
+ get {
+ return ResourceManager.GetString("SettingsEventNotifyReceiverRole", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Channel for event start notifications.
+ ///
+ internal static string SettingsEventStartedChannel {
+ get {
+ return ResourceManager.GetString("SettingsEventStartedChannel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Event start notifications receivers.
+ ///
+ internal static string SettingsEventStartedReceivers {
+ get {
+ return ResourceManager.GetString("SettingsEventStartedReceivers", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to :(.
+ ///
+ internal static string SettingsFrowningFace {
+ get {
+ return ResourceManager.GetString("SettingsFrowningFace", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Language.
+ ///
+ internal static string SettingsLang {
+ get {
+ return ResourceManager.GetString("SettingsLang", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Mute role.
+ ///
+ internal static string SettingsMuteRole {
+ get {
+ return ResourceManager.GetString("SettingsMuteRole", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Nothing changed! `{0}` is already set to {1}.
+ ///
+ internal static string SettingsNothingChanged {
+ get {
+ return ResourceManager.GetString("SettingsNothingChanged", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Prefix.
+ ///
+ internal static string SettingsPrefix {
+ get {
+ return ResourceManager.GetString("SettingsPrefix", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Receive startup messages.
+ ///
+ internal static string SettingsReceiveStartupMessages {
+ get {
+ return ResourceManager.GetString("SettingsReceiveStartupMessages", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Remove roles on mute.
+ ///
+ internal static string SettingsRemoveRolesOnMute {
+ get {
+ return ResourceManager.GetString("SettingsRemoveRolesOnMute", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Send welcome messages.
+ ///
+ internal static string SettingsSendWelcomeMessages {
+ get {
+ return ResourceManager.GetString("SettingsSendWelcomeMessages", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Starter role.
+ ///
+ internal static string SettingsStarterRole {
+ get {
+ return ResourceManager.GetString("SettingsStarterRole", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Welcome message.
+ ///
+ internal static string SettingsWelcomeMessage {
+ get {
+ return ResourceManager.GetString("SettingsWelcomeMessage", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Message deleted in {0}, but I forgot what was there.
+ ///
+ internal static string UncachedMessageDeleted {
+ get {
+ return ResourceManager.GetString("UncachedMessageDeleted", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Message edited from {0} in channel {1}, but I forgot what was there before the edit: {2}.
+ ///
+ internal static string UncachedMessageEdited {
+ get {
+ return ResourceManager.GetString("UncachedMessageEdited", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to That user doesn't exist!.
+ ///
+ internal static string UserDoesntExist {
+ get {
+ return ResourceManager.GetString("UserDoesntExist", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to User not banned!.
+ ///
+ internal static string UserNotBanned {
+ get {
+ return ResourceManager.GetString("UserNotBanned", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The specified user is not a member of this server!.
+ ///
+ internal static string UserNotInGuild {
+ get {
+ return ResourceManager.GetString("UserNotInGuild", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0} unbanned {1} for {2}.
+ ///
+ internal static string UserUnbanned {
+ get {
+ return ResourceManager.GetString("UserUnbanned", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Yes.
+ ///
+ internal static string Yes {
+ get {
+ return ResourceManager.GetString("Yes", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You were banned by {0} in guild {1} for {2}.
+ ///
+ internal static string YouWereBanned {
+ get {
+ return ResourceManager.GetString("YouWereBanned", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You were kicked by {0} in guild {1} for {2}.
+ ///
+ internal static string YouWereKicked {
+ get {
+ return ResourceManager.GetString("YouWereKicked", resourceCulture);
+ }
+ }
}
}
diff --git a/Boyfriend/Messages.resx b/Boyfriend/Messages.resx
index ed21ef5..4d1685d 100644
--- a/Boyfriend/Messages.resx
+++ b/Boyfriend/Messages.resx
@@ -199,7 +199,7 @@
I couldn't remove role {0} because of an error! {1}
- I cannot mute someone forever using timeouts! Either specify a proper duration, or set a mute role in settings
+ I cannot mute someone for more than 28 days using timeouts! Either specify a duration shorter than 28 days, or set a mute role in settings
I cannot use time-outs on other bots! Try to set a mute role in settings
diff --git a/Boyfriend/Messages.ru.resx b/Boyfriend/Messages.ru.resx
index f252015..0c10ab5 100644
--- a/Boyfriend/Messages.ru.resx
+++ b/Boyfriend/Messages.ru.resx
@@ -187,7 +187,7 @@
Я не смог забрать роль {0} в связи с ошибкой! {1}
- Я не могу заглушить кого-то навсегда, используя тайм-ауты! Или укажи правильную продолжительность, или установи роль мута в настройках
+ Я не могу заглушить кого-то на более чем 28 дней, используя тайм-ауты! Или укажи продолжительность менее 28 дней, или установи роль мута в настройках
Я не могу использовать тайм-ауты на других ботах! Попробуй указать роль мута в настройках
diff --git a/Boyfriend/Utils.cs b/Boyfriend/Utils.cs
index 3238cd6..292b611 100644
--- a/Boyfriend/Utils.cs
+++ b/Boyfriend/Utils.cs
@@ -10,14 +10,6 @@ using Humanizer.Localisation;
namespace Boyfriend;
public static class Utils {
- private static readonly string[] Formats = {
- "%d'd'%h'h'%m'm'%s's'", "%d'd'%h'h'%m'm'", "%d'd'%h'h'%s's'", "%d'd'%h'h'", "%d'd'%m'm'%s's'", "%d'd'%m'm'",
- "%d'd'%s's'", "%d'd'", "%h'h'%m'm'%s's'", "%h'h'%m'm'", "%h'h'%s's'", "%h'h'", "%m'm'%s's'", "%m'm'", "%s's'",
-
- "%d'д'%h'ч'%m'м'%s'с'", "%d'д'%h'ч'%m'м'", "%d'д'%h'ч'%s'с'", "%d'д'%h'ч'", "%d'д'%m'м'%s'с'", "%d'д'%m'м'",
- "%d'д'%s'с'", "%d'д'", "%h'ч'%m'м'%s'с'", "%h'ч'%m'м'", "%h'ч'%s'с'", "%h'ч'", "%m'м'%s'с'", "%m'м'", "%s'с'"
- };
-
public static readonly Random Random = new();
private static readonly Dictionary ReflectionMessageCache = new();
@@ -99,9 +91,34 @@ public static class Utils {
}
public static TimeSpan? GetTimeSpan(ref string from) {
- if (TimeSpan.TryParseExact(from.ToLowerInvariant(), Formats, CultureInfo.InvariantCulture, out var timeSpan))
- return timeSpan;
- return null;
+ var chars = from.AsSpan();
+ var numberBuilder = Boyfriend.StringBuilder;
+ int days = 0, hours = 0, minutes = 0, seconds = 0;
+ foreach (var c in chars)
+ if (char.IsDigit(c)) { numberBuilder.Append(c); } else {
+ if (numberBuilder.Length == 0) return null;
+ switch (c) {
+ case 'd' or 'D' or 'д' or 'Д':
+ days += int.Parse(numberBuilder.ToString());
+ numberBuilder.Clear();
+ break;
+ case 'h' or 'H' or 'ч' or 'Ч':
+ hours += int.Parse(numberBuilder.ToString());
+ numberBuilder.Clear();
+ break;
+ case 'm' or 'M' or 'м' or 'М':
+ minutes += int.Parse(numberBuilder.ToString());
+ numberBuilder.Clear();
+ break;
+ case 's' or 'S' or 'с' or 'С':
+ seconds += int.Parse(numberBuilder.ToString());
+ numberBuilder.Clear();
+ break;
+ default: return null;
+ }
+ }
+
+ return new TimeSpan(days, hours, minutes, seconds);
}
public static string JoinString(ref string[] args, int startIndex) {
@@ -144,7 +161,7 @@ public static class Utils {
public static string GetHumanizedTimeOffset(ref TimeSpan span) {
return span.TotalSeconds > 0
- ? $" {span.Humanize(minUnit: TimeUnit.Second, culture: Messages.Culture)}"
+ ? $" {span.Humanize(2, minUnit: TimeUnit.Second, maxUnit: TimeUnit.Month, culture: Messages.Culture)}"
: Messages.Ever;
}