File tree 4 files changed +23
-5
lines changed
4 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,30 @@ module.exports = class Client extends FrameworkClient {
47
47
locales [ name ] = YAML . parse ( data ) ;
48
48
} ) ;
49
49
50
+ this . keyv = new Keyv ( ) ;
50
51
/** @type {I18n } */
51
52
this . i18n = new I18n ( 'en-GB' , locales ) ;
52
53
/** @type {TicketManager } */
53
54
this . tickets = new TicketManager ( this ) ;
54
55
this . config = config ;
55
56
this . log = log ;
56
57
this . supers = ( process . env . SUPER ?? '' ) . split ( ',' ) ;
58
+ /** @param {import('discord.js/typings').Interaction } interaction */
59
+ this . commands . interceptor = async interaction => {
60
+ if ( ! interaction . inGuild ( ) ) return ;
61
+ const id = interaction . guildId ;
62
+ const cacheKey = `cache/known/guild:${ id } ` ;
63
+ if ( await this . keyv . has ( cacheKey ) ) return ;
64
+ await this . prisma . guild . upsert ( {
65
+ create : {
66
+ id,
67
+ locale : this . i18n . locales . find ( locale => locale === interaction . guild . preferredLocale ) , // undefined if not supported
68
+ } ,
69
+ update : { } ,
70
+ where : { id } ,
71
+ } ) ;
72
+ await this . keyv . set ( cacheKey , true ) ;
73
+ } ;
57
74
}
58
75
59
76
async login ( token ) {
@@ -91,7 +108,6 @@ module.exports = class Client extends FrameworkClient {
91
108
} , ms ( '6h' ) ) ;
92
109
}
93
110
94
- this . keyv = new Keyv ( ) ;
95
111
return super . login ( token ) ;
96
112
}
97
113
Original file line number Diff line number Diff line change @@ -365,7 +365,9 @@ misc:
365
365
this category.
366
366
title : ❌ Insufficient roles
367
367
no_categories :
368
- description : No ticket categories have been configured.
368
+ description : |-
369
+ No ticket categories have been configured.
370
+ Configure your server at {url}.
369
371
title : ❌ There are no ticket categories
370
372
not_ticket :
371
373
description : You can only use this command in tickets.
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ module.exports = {
33
33
new EmbedBuilder ( )
34
34
. setColor ( settings . errorColour )
35
35
. setTitle ( getMessage ( 'misc.no_categories.title' ) )
36
- . setDescription ( getMessage ( 'misc.no_categories.description' ) ) ,
36
+ . setDescription ( getMessage ( 'misc.no_categories.description' , { url : ` ${ process . env . HTTP_EXTERNAL } /settings/ ${ interaction . guildId } ` } ) ) ,
37
37
] ,
38
38
ephemeral : true ,
39
39
} ) ;
@@ -73,4 +73,4 @@ module.exports = {
73
73
} ) ;
74
74
}
75
75
} ,
76
- } ;
76
+ } ;
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ module.exports = class extends Listener {
38
38
new EmbedBuilder ( )
39
39
. setColor ( settings . errorColour )
40
40
. setTitle ( getMessage ( 'misc.no_categories.title' ) )
41
- . setDescription ( getMessage ( 'misc.no_categories.description' ) ) ,
41
+ . setDescription ( getMessage ( 'misc.no_categories.description' , { url : ` ${ process . env . HTTP_EXTERNAL } /settings/ ${ interaction . guildId } ` } ) ) ,
42
42
] ,
43
43
} ) ;
44
44
} else if ( settings . categories . length === 1 ) {
You can’t perform that action at this time.
0 commit comments