コード例 #1
0
        public async Task SubRanks()
        {
            await Context.Message.DeleteAsync();

            var embed = new EmbedBuilder()
            {
                Color = Colours.helpCol
            };

            embed.Title = ("Sub Ranks");
            string desc = "Type " + BotConfig.Load().Prefix + "subrank add <rank> to be added to the sub ranks!";

            if (SubRanksSaves.Load().SubRanks > 1)
            {
                for (int i = 0; i < SubRanksSaves.Load().SubRanks; i++)
                {
                    desc = desc + "\n";
                    desc = desc + SubRanksSaves.Load().Ranks[i];
                }
            }
            else
            {
                desc = desc + "\n- Sub Ranks are to be added soon!";
            }

            embed.Description = (desc);

            var message = await Context.Channel.SendMessageAsync("", false, embed);

            await Delete.DelayDeleteEmbed(message, 30);
        }
コード例 #2
0
        public async Task CreateSubRank([Remainder] string title = null)
        {
            await Context.Message.DeleteAsync();

            if (title != null)
            {
                if (SubRanksSaves.Load().MaxRanks > SubRanksSaves.Load().SubRanks)
                {
                    // Creating object and pushing to file
                    SubRanksSaves SubRanks = new SubRanksSaves();
                    SubRanks.MaxRanks = SubRanksSaves.Load().MaxRanks;
                    for (int i = 0; i < SubRanksSaves.Load().MaxRanks; i++)
                    {
                        SubRanks.Ranks[i] = SubRanksSaves.Load().Ranks[i];
                    }
                    SubRanks.Ranks[SubRanksSaves.Load().SubRanks - 1] = title;
                    SubRanks.SubRanks = SubRanksSaves.Load().SubRanks + 1;
                    SubRanks.Save();

                    // Create Role
                    var perms = new GuildPermissions(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
                    await Context.Guild.CreateRoleAsync(title, perms, null, false, null);

                    // Success Message
                    var embed = new EmbedBuilder()
                    {
                        Color = Colours.adminCol
                    };
                    embed.Title       = "Create Sub Rank";
                    embed.Description = "The sub rank '" + title + "' was created successfully!";
                    var message = await Context.Channel.SendMessageAsync("", false, embed);

                    await Delete.DelayDeleteMessage(message, 30);
                }
                else
                {
                    await errors.sendErrorTemp(Context.Channel, "You have used up all sub ranks!", Colours.errorCol);
                }
            }
            else
            {
                await errors.sendErrorTemp(Context.Channel, "You need to specify the rank title.", Colours.errorCol);
            }
        }
コード例 #3
0
        public async Task HelpAdmin()
        {
            await Context.Message.DeleteAsync();

            var embed = new EmbedBuilder()
            {
                Color = Colours.helpCol
            };

            embed.Title       = ("Bruze MPG New Member Help");
            embed.Description = (BotConfig.Load().Prefix + "settings - View the current server config settings" + "\n" +
                                 BotConfig.Load().Prefix + "settings prefix <prefix> - Change the bot prefix" + "\n" +
                                 BotConfig.Load().Prefix + "settings token <token> - Change the bot token (IMPORTANT! DO NOT DO THIS UNLESS REQUIRED)" + "\n" +
                                 BotConfig.Load().Prefix + "settings newmember <rank> - Change the new user rank" + "\n" +
                                 BotConfig.Load().Prefix + "settings userrank <rank> - Change the user rank" + "\n" +
                                 BotConfig.Load().Prefix + "settings musicrank <rank> - Change the music rank" + "\n" +
                                 BotConfig.Load().Prefix + "settings programmingrank <rank> - Change the programming rank" + "\n" +
                                 BotConfig.Load().Prefix + "settings graphicsrank <rank> - Change the graphics rank" + "\n" +
                                 BotConfig.Load().Prefix + "subrank add <rank> - Add a sub rank (Max: " + SubRanksSaves.Load().MaxRanks + ")" + "\n");

            var message = await Context.Channel.SendMessageAsync("", false, embed);

            await Delete.DelayDeleteEmbed(message, 30);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: CourtneyKitty/Bruze-Bot-V2
        public static void EnsureBotConfigExists()
        {
            if (!Directory.Exists(Path.Combine(AppContext.BaseDirectory, "configuration")))
            {
                Directory.CreateDirectory(Path.Combine(AppContext.BaseDirectory, "configuration"));
            }

            string configLoc   = Path.Combine(AppContext.BaseDirectory, "configuration/config.json");
            string ranksLoc    = Path.Combine(AppContext.BaseDirectory, "configuration/ranks.json");
            string subRanksLoc = Path.Combine(AppContext.BaseDirectory, "configuration/sub_ranks.json");

            if (!File.Exists(configLoc))
            {
                var config = new BotConfig();

                Console.WriteLine("Please enter the following information to save into your configuration/config.json file");
                Console.Write("Bot Token: ");
                config.Token = Console.ReadLine();
                Console.Write("Bot Prefix: ");
                config.Prefix = Console.ReadLine();
                Console.WriteLine("New Member Rank: ");
                config.NewMemberRank = Console.ReadLine();
                Console.WriteLine("User Rank: ");
                config.UserRank = Console.ReadLine();
                Console.WriteLine("Music Rank: ");
                config.MusicRank = Console.ReadLine();
                Console.WriteLine("Programming Rank: ");
                config.ProgrammingRank = Console.ReadLine();
                Console.WriteLine("Graphics Rank: ");
                config.GraphicsRank     = Console.ReadLine();
                config.welcomeChannelId = 0;
                config.Messages         = 1;
                config.Members          = 1;
                Console.WriteLine("You will have to enter the config file to manually set welcomeChannelId, Messages and Members. (configuration/config.json)");
                config.Save();
            }
            Console.WriteLine("Configuration has been loaded");

            if (!File.Exists(ranksLoc))
            {
                var ranks = new RankSaves();
                ranks.newMembersCount  = 0;
                ranks.userCount        = 0;
                ranks.musicCount       = 0;
                ranks.programmingCount = 0;
                ranks.graphicsCount    = 0;
                Console.WriteLine("You will have to enter the ranks save file to manually set the beginning statistics. (configuration/ranks.json)");
                ranks.Save();
            }
            Console.WriteLine("Ranks have been loaded");

            if (!File.Exists(subRanksLoc))
            {
                var subRanks = new SubRanksSaves();
                subRanks.MaxRanks = 20;
                subRanks.SubRanks = 1;
                Console.WriteLine("You will have to enter the sub ranks save file to manually set the beginning statistics. (configuration/sub_ranks.json)");
                subRanks.Save();
            }
            Console.WriteLine("Sub ranks have been loaded");
        }