@@ -49,29 +49,46 @@ module.exports = class TransferSlashCommand extends SlashCommand {
49
49
} ,
50
50
where : { id : interaction . channel . id } ,
51
51
} ) ;
52
- const from = ticket . createdById ;
53
52
54
- await client . prisma . ticket . update ( {
55
- data : {
56
- createdBy : {
57
- connectOrCreate : {
58
- create : { id : member . id } ,
59
- where : { id : member . id } ,
60
- } ,
61
- } ,
62
- } ,
63
- where : { id : interaction . channel . id } ,
64
- } ) ;
53
+ const from = ticket . createdById ;
65
54
66
55
const channelName = ticket . category . channelName
67
56
. replace ( / { + \s ? ( u s e r ) ? n a m e \s ? } + / gi, member . user . username )
68
57
. replace ( / { + \s ? ( n i c k | d i s p l a y ) ( n a m e ) ? \s ? } + / gi, member . displayName )
69
58
. replace ( / { + \s ? n u m ( b e r ) ? \s ? } + / gi, ticket . number === 1488 ? '1487b' : ticket . number ) ;
70
59
71
- await interaction . channel . edit ( {
72
- name : channelName ,
73
- topic : `${ member . toString ( ) } ${ ticket . topic ?. length > 0 ? ` | ${ decrypt ( ticket . topic ) } ` : '' } ` ,
74
- } ) ;
60
+ await Promise . all ( [
61
+ client . prisma . ticket . update ( {
62
+ data : {
63
+ createdBy : {
64
+ connectOrCreate : {
65
+ create : { id : member . id } ,
66
+ where : { id : member . id } ,
67
+ } ,
68
+ } ,
69
+ } ,
70
+ where : { id : interaction . channel . id } ,
71
+ } ) ,
72
+ interaction . channel . edit ( {
73
+ name : channelName ,
74
+ topic : `${ member . toString ( ) } ${ ticket . topic ?. length > 0 ? ` | ${ decrypt ( ticket . topic ) } ` : '' } ` ,
75
+ } ) ,
76
+ interaction . channel . permissionOverwrites . edit (
77
+ member ,
78
+ {
79
+ AttachFiles : true ,
80
+ EmbedLinks : true ,
81
+ ReadMessageHistory : true ,
82
+ SendMessages : true ,
83
+ ViewChannel : true ,
84
+ } ,
85
+ ) ,
86
+ ] ) ;
87
+
88
+ const $category = client . tickets . $count . categories [ ticket . categoryId ] ;
89
+ $category [ from ] -- ;
90
+ $category [ member . id ] ||= 0 ;
91
+ $category [ member . id ] ++ ;
75
92
76
93
await interaction . editReply ( {
77
94
embeds : [
@@ -86,15 +103,5 @@ module.exports = class TransferSlashCommand extends SlashCommand {
86
103
] ,
87
104
} ) ;
88
105
89
- await interaction . channel . permissionOverwrites . edit (
90
- member ,
91
- {
92
- AttachFiles : true ,
93
- EmbedLinks : true ,
94
- ReadMessageHistory : true ,
95
- SendMessages : true ,
96
- ViewChannel : true ,
97
- } ,
98
- ) ;
99
106
}
100
107
} ;
0 commit comments