choose, fixed permissions for poll

This commit is contained in:
Master Kwoth 2016-02-06 23:35:33 +01:00
parent cde75c138c
commit 1ab0b01f43
2 changed files with 18 additions and 0 deletions

View File

@ -21,6 +21,8 @@ namespace NadekoBot.Modules {
.Description("Creates a poll, only person who has manage server permission can do it.\n**Usage**: >poll What is my question?;Answer1;Answer 2; Answer 3")
.Parameter("allargs", ParameterType.Unparsed)
.Do(e => {
if (!e.User.ServerPermissions.ManageChannels)
return;
if (ActivePolls.ContainsKey(e.Server))
return;
var arg = e.GetArg("allargs");
@ -35,6 +37,8 @@ namespace NadekoBot.Modules {
cgb.CreateCommand(">pollend")
.Description("Stops active poll on this server and prints the results in this channel.")
.Do(async e => {
if (!e.User.ServerPermissions.ManageChannels)
return;
if (!ActivePolls.ContainsKey(e.Server))
return;
await ActivePolls[e.Server].StopPoll(e.Channel);

View File

@ -23,6 +23,20 @@ namespace NadekoBot.Modules
manager.CreateCommands("", cgb =>
{
commands.ForEach(cmd => cmd.Init(cgb));
cgb.CreateCommand(">choose")
.Description("Chooses a thing from a list of things\n**Usage**: >choose Get up;Sleep more;Sleep even more")
.Parameter("list", Discord.Commands.ParameterType.Unparsed)
.Do(async e => {
var arg = e.GetArg("list");
if (string.IsNullOrWhiteSpace(arg))
return;
var list = arg.Split(';');
if (list.Count() < 2)
return;
await e.Send(list[new Random().Next(0, list.Length)]);
});
cgb.CreateCommand(">")
.Description("Attack a person. Supported attacks: 'splash', 'strike', 'burn', 'surge'.\n**Usage**: > strike @User")
.Parameter("attack_type",Discord.Commands.ParameterType.Required)