CreateCommand() public method

public CreateCommand ( string cmd ) : CommandBuilder
cmd string
return CommandBuilder
示例#1
0
        private static void BuildCommands(CommandGroupBuilder group)
        {
            group.DefaultMinPermissions(0);

            group.CreateCommand("al")
                .WithPurpose("Get anilist user.")
                .ArgsAtLeast(1)
                .Do(Modules.AnimeTools.UserFromAnilist);

            group.CreateCommand("source")
                .WithPurpose("Link to my Github baby ;))))")
                .Do(async e =>
                    await BotTools.Tools.ReplyAsync(e, "Here's my source code! <https://github.com/stepperman/HB-Discord-Bot>"));

            group.CreateCommand("yt").Alias("youtube")
                .ArgsAtLeast(1)
                .WithPurpose("Find YouTube videos!")
                .Do(qtbot.Modules.YouTube.FindYouTubeVideo);

            group.CreateCommand("anime")
                .ArgsAtLeast(1)
                .WithPurpose("Get an anime from Anilist.")
                .Do(qtbot.Modules.AnimeTools.AnimeFromAnilist);

            group.CreateCommand("uptime")
                .Do(qtbot.Modules.Uptime.ShowUptime)
                .WithPurpose("show the bot's uptime.");

            group.CreateCommand("bullying")
                .Do(qtbot.Modules.Fun.Bullying)
                .WithPurpose("Getting bullied? Make sure to use this command as often as possible!")
                .MinuteDelay(1);

            group.CreateCommand("downtime")
                .Do(async e =>
                    await BotTools.Tools.ReplyAsync(e, "a **long time.**"));

            group.CreateCommand("ud")
                .WithPurpose("Find the definition of a word with Urban Dictionary.")
                .Do(Modules.Fun.UrbanDictionary);

            group.CreateCommand("hb")
                .WithPurpose("Find a User's HummingBird account with it's information!")
                .ArgsAtMax(1)
                .IsHidden()
                .Do(Modules.AnimeTools.GetHBUser);

            group.CreateCommand("8ball")
                .WithPurpose("The magic eightball will answer all your doubts and questions!")
                .AnyArgs()
                .SecondDelay(20)
                .Do(Modules.Fun.EightBall);

            group.CreateCommand("lmao")
                .AnyArgs()
                .HourDelay(1)
                .Do(async e =>
                    await BotTools.Tools.ReplyAsync(e, "https://www.youtube.com/watch?v=HTLZjhHIEdw"));

            group.CreateCommand("no")
                .SecondDelay(120)
                .AnyArgs()
                .Do(async e =>
                    await BotTools.Tools.ReplyAsync(e, "pignig", false));

            group.CreateCommand("ayy")
                .MinuteDelay(2)
                .AnyArgs()
                .Do(Modules.Fun.Ayy);

            group.CreateCommand("commands")
                .AnyArgs()
                .IsHidden()
                .Do(Modules.Information.Commands);

            group.CreateCommand("img")
                .MinuteDelay(1)
                .ArgsAtLeast(1)
                .WithPurpose("Get an image of Google. (100 per day pls)")
                .Do(Modules.Fun.GetImageFromGoogleDotCom);
        }
示例#2
0
        private static void BuildAdminCommands(CommandGroupBuilder adminGroup)
        {
            adminGroup.DefaultMinPermissions(90);

            adminGroup.CreateCommand("change nickname").Alias("nick")
                .MinPermissions(1000)
                .WithPurpose("Change the bot's username.")
                .ArgsAtLeast(1)
                .Do(AdminCommands.ChangeNickname);

            adminGroup.CreateCommand("change username").Alias("username")
                .MinPermissions(8000)
                .ArgsAtLeast(1)
                .Do(AdminCommands.ChangeUsername);

            adminGroup.CreateCommand("change avatar").Alias("avatar")
                .MinPermissions(1000)
                .WithPurpose("Change the bot's avatar.")
                .ArgsAtLeast(1)
                .Do(AdminCommands.ChangeAvatar);

            adminGroup.CreateCommand("role").Alias("r")
                .MinPermissions(500)
                .WithPurpose("Remove or add a role. Usage: `-role add/remove @{user(s)} Role name`")
                .Do(AdminCommands.AddRemoveRole);

            adminGroup.CreateCommand("delete").Alias("d", "remove")
                .WithPurpose("Delete messages on this channel. Usage: `/admin delete {number of messages to delete}`. / req: rank perm > 0")
                .ArgsAtLeast(1)
                .Do(AdminCommands.DeleteMessages);

            adminGroup.CreateCommand("addpermission")
                .WithPurpose("Add number to rank. Usage: `/admin addpermission {rank name} {number}` / req: rank perm >= 1000")
                .Do(AdminCommands.AddPermissionToRank);

            adminGroup.CreateCommand("removePerm")
                .WithPurpose("Remove number of rank. Usage: `/admin addpermission {rank name}` / req: rank perm >= 1000")
                .Do(AdminCommands.RemovePermissionToRank);

            adminGroup.CreateCommand("editServer")
                .WithPurpose("standardrole or welcomechannel. / req: rank perm >= 1000")
                .Do(AdminCommands.EditServer);

            adminGroup.CreateCommand("timeout").Alias("t")
                .WithPurpose("Time out someone. Usage: `/admin timeout {@username} {time in minutes}`.")
                .ArgsAtLeast(1)
                .Do(AdminCommands.TimeoutUser);

            adminGroup.CreateCommand("commands")
                .IsHidden()
                .AnyArgs()
                .Do(AdminCommands.GetCommands);

            adminGroup.CreateCommand("save")
                .Do(async e =>
                {
                    if (BotTools.Storage.programInfo.DevID == e.Author.Id)
                        await Modules.RegularUsers.SaveAsync();
                });

            adminGroup.CreateCommand("clearperms")
                .MinPermissions(999)
                .Do(async e =>
                {
                    var serverInfo = BotTools.Tools.GetServerInfo(e.Guild.Id);
                    serverInfo.roleImportancy.Clear();
                    await Task.Delay(0);
                    BotTools.Tools.SaveServerInfo();
                });
        }