few more fixes, added .iamn
This commit is contained in:
parent
61fe84bbbc
commit
170be53e5d
@ -9,6 +9,7 @@ namespace NadekoBot.Classes.JSONModels {
|
|||||||
public bool DontJoinServers { get; set; } = false;
|
public bool DontJoinServers { get; set; } = false;
|
||||||
public bool ForwardMessages { get; set; } = true;
|
public bool ForwardMessages { get; set; } = true;
|
||||||
public bool IsRotatingStatus { get; set; } = false;
|
public bool IsRotatingStatus { get; set; } = false;
|
||||||
|
[JsonIgnore]
|
||||||
public List<Quote> Quotes { get; set; } = new List<Quote>();
|
public List<Quote> Quotes { get; set; } = new List<Quote>();
|
||||||
public HashSet<StreamNotificationConfig> ObservingStreams { get; set; } = new HashSet<StreamNotificationConfig>();
|
public HashSet<StreamNotificationConfig> ObservingStreams { get; set; } = new HashSet<StreamNotificationConfig>();
|
||||||
public List<string> RotatingStatuses { get; set; } = new List<string>();
|
public List<string> RotatingStatuses { get; set; } = new List<string>();
|
||||||
|
@ -104,6 +104,34 @@ namespace NadekoBot.Commands {
|
|||||||
await e.User.AddRoles(role);
|
await e.User.AddRoles(role);
|
||||||
await e.Channel.SendMessage($":ok:You now have {role.Name} 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.");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace NadekoBot.Modules {
|
|||||||
|
|
||||||
manager.CreateCommands("", cgb => {
|
manager.CreateCommands("", cgb => {
|
||||||
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
|
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
|
||||||
|
|
||||||
cgb.CreateCommand("e")
|
cgb.CreateCommand("e")
|
||||||
.Description("You did it.")
|
.Description("You did it.")
|
||||||
.Do(async e => {
|
.Do(async e => {
|
||||||
@ -173,11 +173,14 @@ namespace NadekoBot.Modules {
|
|||||||
.Description("Pat someone ^_^")
|
.Description("Pat someone ^_^")
|
||||||
.Parameter("user", ParameterType.Unparsed)
|
.Parameter("user", ParameterType.Unparsed)
|
||||||
.Do(async e => {
|
.Do(async e => {
|
||||||
var user = e.GetArg("user");
|
var userStr = e.GetArg("user");
|
||||||
if (string.IsNullOrWhiteSpace(user) || !e.Message.MentionedUsers.Any()) return;
|
if (string.IsNullOrWhiteSpace(userStr) || !e.Message.MentionedUsers.Any()) return;
|
||||||
|
var user = e.Server.FindUsers(userStr).FirstOrDefault();
|
||||||
|
if (user == null)
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
await e.Channel.SendMessage(
|
await e.Channel.SendMessage(
|
||||||
$"{e.Message.MentionedUsers.First().Mention} " +
|
$"{user.Mention} " +
|
||||||
$"{NadekoBot.Config.PatResponses[rng.Next(0, NadekoBot.Config.PatResponses.Length)]}");
|
$"{NadekoBot.Config.PatResponses[rng.Next(0, NadekoBot.Config.PatResponses.Length)]}");
|
||||||
} catch {
|
} catch {
|
||||||
await e.Channel.SendMessage("Error while handling PatResponses check your data/config.json");
|
await e.Channel.SendMessage("Error while handling PatResponses check your data/config.json");
|
||||||
|
Loading…
Reference in New Issue
Block a user