fixed permissions for important commands

This commit is contained in:
Kwoth 2016-01-16 22:44:34 +01:00
parent 168f553807
commit 7454f5611d

View File

@ -248,6 +248,7 @@ namespace NadekoBot.Modules
.Parameter("topic", ParameterType.Unparsed) .Parameter("topic", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
try { try {
if(e.User.ServerPermissions.ManageChannels)
await e.Channel.Edit(topic: e.GetArg("topic")); await e.Channel.Edit(topic: e.GetArg("topic"));
} catch (Exception) { } } catch (Exception) { }
}); });
@ -296,6 +297,7 @@ namespace NadekoBot.Modules
cgb.CreateCommand(".leaveall") cgb.CreateCommand(".leaveall")
.Description("Nadeko leaves all servers") .Description("Nadeko leaves all servers")
.Do(e => { .Do(e => {
if(e.User.Id == NadekoBot.OwnerID)
NadekoBot.client.Servers.ForEach(async s => { if (s.Name == "NadekoLog" || s.Name == "Discord Bots") return; await s.Leave(); }); NadekoBot.client.Servers.ForEach(async s => { if (s.Name == "NadekoLog" || s.Name == "Discord Bots") return; await s.Leave(); });
}); });
@ -304,6 +306,8 @@ namespace NadekoBot.Modules
.Parameter("num", ParameterType.Required) .Parameter("num", ParameterType.Required)
.Description("Prunes a number of messages from the current channel.\n**Usage**: .prune 50") .Description("Prunes a number of messages from the current channel.\n**Usage**: .prune 50")
.Do(async e => { .Do(async e => {
if (!e.User.ServerPermissions.ManageMessages) return;
int num; int num;
if (!Int32.TryParse(e.GetArg("num"), out num) || num < 1) { if (!Int32.TryParse(e.GetArg("num"), out num) || num < 1) {
@ -393,6 +397,8 @@ namespace NadekoBot.Modules
.Description("Sets a new announce message. Type %user% if you want to mention the new member.\n**Usage**: .greetmsg Welcome to the server, %user%.") .Description("Sets a new announce message. Type %user% if you want to mention the new member.\n**Usage**: .greetmsg Welcome to the server, %user%.")
.Parameter("msg",ParameterType.Unparsed) .Parameter("msg",ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
if (e.User.Id != NadekoBot.OwnerID) return;
if (e.GetArg("msg") == null) return; if (e.GetArg("msg") == null) return;
announceMsg = e.GetArg("msg"); announceMsg = e.GetArg("msg");
await e.Send("New message set."); await e.Send("New message set.");