예제 #1
0
        public async Task PrefixSuccess(CommandContext ctx, [DSharpPlus.CommandsNext.Attributes.Description("The operation to be executed [add/list/del] ")]
                                        string operation)
        {
            switch (operation.ToLowerInvariant())
            {
            case "add":
                var msg = await ctx.RespondAsync(embed : EmbedBase.InputEmbed("Prefix to be added"));

                InteractivityResult <DiscordMessage> response = await ctx.Message.GetNextMessageAsync();

                var prefix = response.Result.Content;
                if (Program.Config.Prefixes.Contains(prefix.ToLowerInvariant()))
                {
                    await msg.ModifyAsync(embed : EmbedBase.OutputEmbed($"This prefix is already added."));
                }
                else
                {
                    Program.Config.Prefixes.Add(prefix.ToLowerInvariant());
                    File.WriteAllText(Directory.GetCurrentDirectory() + "/Config.json",
                                      JsonConvert.SerializeObject(Program.Config, Formatting.Indented));
                    await msg.ModifyAsync(embed : EmbedBase.OutputEmbed($"Prefix added without errors."));
                }

                break;

            case "del":
                var msg2 = await ctx.RespondAsync(embed : EmbedBase.InputEmbed("Prefix to be removed"));

                InteractivityResult <DiscordMessage> response2 = await ctx.Message.GetNextMessageAsync();

                var prefix2 = response2.Result.Content;
                if (!Program.Config.Prefixes.Contains(prefix2.ToLowerInvariant()))
                {
                    await msg2.ModifyAsync(embed : EmbedBase.OutputEmbed($"This prefix doesn't exists."));
                }
                else
                {
                    Program.Config.Prefixes.Remove(prefix2.ToLowerInvariant());
                    File.WriteAllText(Directory.GetCurrentDirectory() + "/Config.json",
                                      JsonConvert.SerializeObject(Program.Config, Formatting.Indented));
                    await msg2.ModifyAsync(embed : EmbedBase.OutputEmbed($"Prefix removed without errors."));
                }
                break;

            case "list":
                await ctx.RespondAsync(embed : EmbedBase.OrderedListEmbed(Program.Config.Prefixes, "Prefixes"));

                break;

            default:
                var embed = EmbedBase.CommandHelpEmbed(ctx.Command);
                await ctx.RespondAsync(embed : embed);

                break;
            }
        }
예제 #2
0
파일: prisao.cs 프로젝트: joaodev123/CSUB
 public async Task soltarFailed(CommandContext ctx) => await ctx.RespondAsync(embed : EmbedBase.CommandHelpEmbed(ctx.Command));
예제 #3
0
 public async Task AddFail(CommandContext ctx)
 {
     await ctx.RespondAsync(embed : EmbedBase.CommandHelpEmbed(ctx.Command));
 }
예제 #4
0
 public async Task PrefixError(CommandContext ctx)
 {
     var embed = EmbedBase.CommandHelpEmbed(ctx.Command);
     await ctx.RespondAsync(embed : embed);
 }
예제 #5
0
 public async Task RemoveFail(CommandContext ctx) => await ctx.RespondAsync(embed : EmbedBase.CommandHelpEmbed(ctx.Command));