diff --git a/NadekoBot/Classes/JSONModels/Configuration.cs b/NadekoBot/Classes/JSONModels/Configuration.cs index b343ef26..e4acf120 100644 --- a/NadekoBot/Classes/JSONModels/Configuration.cs +++ b/NadekoBot/Classes/JSONModels/Configuration.cs @@ -9,6 +9,7 @@ namespace NadekoBot.Classes.JSONModels { public bool DontJoinServers { get; set; } = false; public bool ForwardMessages { get; set; } = true; public bool IsRotatingStatus { get; set; } = false; + [JsonIgnore] public List Quotes { get; set; } = new List(); public HashSet ObservingStreams { get; set; } = new HashSet(); public List RotatingStatuses { get; set; } = new List(); diff --git a/NadekoBot/Commands/SelfAssignedRolesCommand.cs b/NadekoBot/Commands/SelfAssignedRolesCommand.cs index f1354ca0..ac87225a 100644 --- a/NadekoBot/Commands/SelfAssignedRolesCommand.cs +++ b/NadekoBot/Commands/SelfAssignedRolesCommand.cs @@ -104,6 +104,34 @@ namespace NadekoBot.Commands { await e.User.AddRoles(role); await e.Channel.SendMessage($":ok:You now have {role.Name} role."); }); + + cgb.CreateCommand(".iamn") + .Alias(".iamnot") + .Description("Removes a role to you that you choose. " + + "Role must be on a list of self-assignable roles." + + "\n**Usage**: .iamn Gamer") + .Parameter("role", ParameterType.Unparsed) + .Do(async e => { + var roleName = e.GetArg("role")?.Trim(); + if (string.IsNullOrWhiteSpace(roleName)) + return; + var role = e.Server.FindRoles(roleName).FirstOrDefault(); + if (role == null) { + await e.Channel.SendMessage(":anger:That role does not exist."); + return; + } + var config = SpecificConfigurations.Default.Of(e.Server.Id); + if (!config.ListOfSelfAssignableRoles.Contains(role.Id)) { + await e.Channel.SendMessage(":anger:That role is not self-assignable."); + return; + } + if (!e.User.HasRole(role)) { + await e.Channel.SendMessage($":anger:You don't have {role.Name} role."); + return; + } + await e.User.RemoveRoles(role); + await e.Channel.SendMessage($":ok:Successfuly removed {role.Name} role from you."); + }); } } } diff --git a/NadekoBot/Modules/Conversations.cs b/NadekoBot/Modules/Conversations.cs index 7d74a4f2..c32f4818 100644 --- a/NadekoBot/Modules/Conversations.cs +++ b/NadekoBot/Modules/Conversations.cs @@ -28,7 +28,7 @@ namespace NadekoBot.Modules { manager.CreateCommands("", cgb => { cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance); - + cgb.CreateCommand("e") .Description("You did it.") .Do(async e => { @@ -173,11 +173,14 @@ namespace NadekoBot.Modules { .Description("Pat someone ^_^") .Parameter("user", ParameterType.Unparsed) .Do(async e => { - var user = e.GetArg("user"); - if (string.IsNullOrWhiteSpace(user) || !e.Message.MentionedUsers.Any()) return; + var userStr = e.GetArg("user"); + if (string.IsNullOrWhiteSpace(userStr) || !e.Message.MentionedUsers.Any()) return; + var user = e.Server.FindUsers(userStr).FirstOrDefault(); + if (user == null) + return; try { await e.Channel.SendMessage( - $"{e.Message.MentionedUsers.First().Mention} " + + $"{user.Mention} " + $"{NadekoBot.Config.PatResponses[rng.Next(0, NadekoBot.Config.PatResponses.Length)]}"); } catch { await e.Channel.SendMessage("Error while handling PatResponses check your data/config.json");