few more fixes, added .iamn

This commit is contained in:
Master Kwoth 2016-03-16 02:29:41 +01:00
parent 61fe84bbbc
commit 170be53e5d
3 changed files with 36 additions and 4 deletions

View File

@ -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<Quote> Quotes { get; set; } = new List<Quote>();
public HashSet<StreamNotificationConfig> ObservingStreams { get; set; } = new HashSet<StreamNotificationConfig>();
public List<string> RotatingStatuses { get; set; } = new List<string>();

View File

@ -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.");
});
}
}
}

View File

@ -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");