@@ -341,14 +341,19 @@ export class HelpThreadModule extends Module {
341
341
342
342
@command ( { single : true , description : 'Help System: Rename a help thread' } )
343
343
async title ( msg : Message , title : string ) {
344
- if ( ! isHelpThread ( msg . channel ) )
344
+ const m = / ^ < # ( \d + ) > \s * ( [ ^ ] * ) / . exec ( title ) ;
345
+ let thread : Omit < Channel , 'partial' > | undefined = msg . channel ;
346
+ if ( m ) {
347
+ thread = msg . guild ?. channels . cache . get ( m [ 1 ] ) ! ;
348
+ title = m [ 2 ] ;
349
+ }
350
+ if ( ! thread || ! isHelpThread ( thread ) )
345
351
return sendWithMessageOwnership (
346
352
msg ,
347
353
':warning: This can only be run in a help thread' ,
348
354
) ;
349
355
if ( ! title )
350
356
return sendWithMessageOwnership ( msg , ':warning: Missing title' ) ;
351
- const thread = msg . channel ;
352
357
const threadData = ( await HelpThread . findOne ( thread . id ) ) ! ;
353
358
if (
354
359
msg . author . id !== threadData . ownerId &&
@@ -374,8 +379,11 @@ export class HelpThreadModule extends Module {
374
379
titleSetTimestamp : Date . now ( ) + '' ,
375
380
} ) ,
376
381
// Truncate if longer than 100, the max thread title length
377
- msg . channel . setName ( `${ username } - ${ title } ` . slice ( 0 , 100 ) ) ,
382
+ thread . setName ( `${ username } - ${ title } ` . slice ( 0 , 100 ) ) ,
378
383
] ) ;
384
+ if ( thread !== msg . channel ) {
385
+ await msg . react ( '✅' ) ;
386
+ }
379
387
}
380
388
381
389
@command ( )
0 commit comments