Exemplo n.º 1
0
        public async Task TagRenameCommandAsync(string tagName, string newName)
        {
            var result = await DatabaseTags.EditTagInDatabase(Context, tagName, "name", newName);

            if (result == 2)
            {
                await ReplyAsync($"Tag '{tagName}' renamed to '{newName}'.");
            }
            else if (result == 1)
            {
                await ReplyAsync("Couldn't rename tag - you are not the author of that tag.");
            }
            else if (result == 0)
            {
                // attempt to find a tag & retry
                await FindTagAndRetry("rename", tagName, newName);
            }
        }
Exemplo n.º 2
0
        public async Task TagDescribeCommandAsync(string tagName, [Remainder] string description)
        {
            var result = await DatabaseTags.EditTagInDatabase(Context, tagName, "description", description);

            if (result == 2)
            {
                await ReplyAsync($"Tag '{tagName}' description set.");
            }
            else if (result == 1)
            {
                await ReplyAsync("Couldn't set tag's description - you are not the author of that tag.");
            }
            else if (result == 0)
            {
                // attempt to find a tag & retry
                await FindTagAndRetry("describe", tagName, description);
            }
        }
Exemplo n.º 3
0
        public async Task TagEditCommandAsync(string tagName, [Remainder] string newContent)
        {
            var result = await DatabaseTags.EditTagInDatabase(Context, tagName, "text", newContent);

            if (result == 2)
            {
                await ReplyAsync($"Tag '{tagName}' edited.");
            }
            else if (result == 1)
            {
                await ReplyAsync("Couldn't edit tag - you are not the author of that tag.");
            }
            else if (result == 0)
            {
                // attempt to find a tag & retry
                await FindTagAndRetry("edit", tagName, newContent);
            }
        }
Exemplo n.º 4
0
        public async Task TagGlobalCommandAsync(string tagName, string flag)
        {
            bool global;

            if (flag == "true" || flag == "yes")
            {
                global = true;
            }
            else
            if (flag == "false" || flag == "no")
            {
                global = false;
            }
            else
            {
                await ReplyAsync($"Invalid flag '{flag}' entered. Command accepts true/yes and false/no.");

                return;
            }

            var result = await DatabaseTags.EditTagInDatabase(Context, tagName, "global", global);

            if (result == 2)
            {
                await ReplyAsync($"Tag '{tagName}' global status set to '{flag}'.");
            }
            else if (result == 1)
            {
                await ReplyAsync("Couldn't set tag's global status - you are not the author of that tag.");
            }
            else if (result == 0)
            {
                // attempt to find a tag & retry
                await FindTagAndRetry("global", tagName, flag);
            }
        }