Exemple #1
0
        public async Task Create(string name, [Remainder] string content)
        {
            if (!TagUtilities.IsWithinNameLimit(name))
            {
                await ReplyAsync("Tag names cannot be greater than 50 characters.");

                return;
            }

            var current = await _tagService.GetTagSummaries(Context.Guild.Id, x => x.OwnerId == Context.User.Id);

            if (!TagUtilities.IsWithinMaxTagLimit(current))
            {
                await ReplyAsync($"{Context.User.Mention} you have reached your limit of 15 tags.");

                return;
            }

            try
            {
                await _tagService.CreateTagAsync(Context.Guild.Id, Context.User.Id, name, content);
                await ReplyAsync($"Created tag \"{name}\".");
            }
            catch (TagAlreadyExistsException)
            {
                await ReplyAsync($"A tag by name \"{name}\" already exists.");
            }
        }