示例#1
0
        public async Task GetEmbedPresetListAsync()
        {
            var    fileNames = EmbedPreset.GetPresetNames();
            string message   = "Embed presets:\n```";

            fileNames.ForEach(x => message += x + "\n");
            message += "```";

            await ReplyAsync(message);
        }
示例#2
0
        public async Task SendEmbedPresetAsync(ITextChannel channel, string presetName)
        {
            if (!EmbedPreset.PresetExists(presetName))
            {
                await ReplyAsync("Preset not found");

                return;
            }

            await channel.SendMessageAsync(embed : EmbedPreset.LoadPreset(presetName).ConstructEmbed());
        }
示例#3
0
        public async Task AddNewEmbedPresetAsync(string name)
        {
            if (EmbedPreset.PresetExists(name))
            {
                await ReplyAsync("Preset with that name already exists");

                return;
            }
            if (Context.Message.Attachments.Count == 0)
            {
                await ReplyAsync("No attachment found");

                return;
            }
            var attachment = Context.Message.Attachments.FirstOrDefault(x => x.Filename[(x.Filename.LastIndexOf('.') + 1)..] == "txt");