11import { escapeMarkdown } from "#common/discord/markdown.ts" ;
22import { moduleLogger } from "#common/logger/index.ts" ;
3+ import { Color } from "#common/schema/general.ts" ;
4+ import type { StringReader } from "#common/stringReader.ts" ;
35import { defineCommand } from "#plugin/core/public/extensionPoints.ts" ;
46import { permissionsGuard } from "#plugin/core/public/helper/commandGuards.ts" ;
57import { icons } from "#plugin/core/public/icons.ts" ;
@@ -8,6 +10,7 @@ import {
810 MAX_TAG_NAME_LENGTH ,
911} from "#plugin/tags/constants.ts" ;
1012import { autocompleteTags } from "#plugin/tags/helper/autocompletion.ts" ;
13+ import { attachments , optionalColor } from "#plugin/tags/helper/customOptionTypes.ts" ;
1114import { tagsConfigStore } from "#plugin/tags/index.ts" ;
1215import { onTagEdited } from "#plugin/tags/public/extensionPoints.ts" ;
1316import { updateTag } from "#plugin/tags/storage/tags.ts" ;
@@ -25,22 +28,36 @@ export default defineCommand({
2528 description : "The name of the tag to modify." ,
2629 required : true ,
2730 position : 0 ,
28- maxLength : MAX_TAG_NAME_LENGTH ,
31+
2932 greedy : false ,
33+ maxLength : MAX_TAG_NAME_LENGTH ,
3034
3135 autocomplete : ( ctx , value ) => autocompleteTags ( ctx , value ) ,
3236 } ,
37+ newName : {
38+ type : "string" ,
39+ name : [ "new-name" , "rename" , "nn" , "rn" ] ,
40+ description : "Specify a new name to rename to." ,
41+
42+ maxLength : MAX_TAG_NAME_LENGTH ,
43+ } ,
3344 content : {
3445 type : "string" ,
3546 name : [ "content" , "c" ] ,
47+ description : "Modify the content." ,
3648 position : 1 ,
49+
3750 maxLength : MAX_TAG_CONTENT_LENGTH ,
3851 } ,
39- newName : {
40- type : "string" ,
41- name : [ "new-name" , "rename" , "nn" , "rn" ] ,
42- description : "Change the name of the tag to something else." ,
43- maxLength : MAX_TAG_NAME_LENGTH ,
52+ attachments : {
53+ type : attachments ,
54+ name : [ "attachments" , "attach" , "a" ] ,
55+ description : "Modify attachments, specified as links separated by spaces or simply 'clear' to remove them."
56+ } ,
57+ color : {
58+ type : optionalColor ,
59+ name : [ "color" , "c" ] ,
60+ description : "Modify the color of the tag. This will display "
4461 } ,
4562 } ,
4663
@@ -54,6 +71,8 @@ export default defineCommand({
5471 const changes = {
5572 name : args . newName ,
5673 content : args . content ,
74+ attachments : args . attachments ,
75+ color : args . color ,
5776 } ;
5877
5978 const oldTag = await updateTag (
@@ -71,7 +90,7 @@ export default defineCommand({
7190 }
7291
7392 // check after we know the tag exists
74- if ( args . newName === null && args . content === null ) {
93+ if ( changes . name === null && changes . content === null && changes . attachments === null && changes . color === null ) {
7594 await ctx . respond ( `${ icons . error } No changes specified!` ) ;
7695 return ;
7796 }
0 commit comments