44 ActionRowBuilder ,
55 ApplicationCommandOptionType ,
66 ApplicationCommandType ,
7+ ApplicationIntegrationType ,
78 AutocompleteInteraction ,
89 ButtonBuilder ,
910 ButtonStyle ,
@@ -12,6 +13,7 @@ import {
1213 ComponentType ,
1314 EmbedBuilder ,
1415 GuildMember ,
16+ InteractionContextType ,
1517 MessageFlags ,
1618 type ApplicationCommandOptionData ,
1719 type CacheType ,
@@ -54,8 +56,8 @@ interface Command {
5456 name : string ;
5557 description : string ;
5658 options ?: ApplicationCommandOptionData [ ] ;
57- integration_types ?: number [ ] ;
58- contexts ?: number [ ] ;
59+ integration_types ?: ApplicationIntegrationType [ ] ;
60+ contexts ?: InteractionContextType [ ] ;
5961 type ?: ApplicationCommandType ;
6062 } ;
6163 execute : ( interaction : ChatInputCommandInteraction ) => Promise < void > ;
@@ -64,6 +66,8 @@ interface Command {
6466 ) => Promise < any > ;
6567}
6668
69+ // Context 2: Interaction can be used within Group DMs and DMs other than the app's bot user
70+ // /track, /tracked and /untracked can't be used in these contexts
6771const commands : Record < string , Command > = {
6872 ping : {
6973 data : {
@@ -76,7 +80,7 @@ const commands: Record<string, Command> = {
7680 execute : async ( interaction : CommandInteraction ) => {
7781 await interaction
7882 . reply ( {
79- ephemeral : false ,
83+ flags : MessageFlags . Ephemeral ,
8084 content : `Ping: ${ interaction . client . ws . ping } ms` ,
8185 } )
8286 . catch ( console . error ) ;
@@ -134,7 +138,7 @@ const commands: Record<string, Command> = {
134138 execute : async ( interaction : CommandInteraction ) => {
135139 await interaction
136140 . reply ( {
137- ephemeral : false ,
141+ flags : MessageFlags . Ephemeral ,
138142 content : `Uptime: ${ (
139143 performance . now ( ) /
140144 ( 86400 * 1000 )
@@ -149,7 +153,7 @@ const commands: Record<string, Command> = {
149153 name : "hmm" ,
150154 description : "What does this command do?" ,
151155 integration_types : [ 0 , 1 ] ,
152- contexts : [ 0 , 1 ] ,
156+ contexts : [ 0 , 1 , 2 ] ,
153157 } ,
154158 execute : async ( interaction : CommandInteraction ) => {
155159 await interaction . reply ( {
@@ -173,7 +177,7 @@ const commands: Record<string, Command> = {
173177 Bun . gc ( false ) ;
174178 await interaction
175179 . reply ( {
176- ephemeral : false ,
180+ flags : MessageFlags . Ephemeral ,
177181 content : [
178182 `Heap size: ${ ( heap . heapSize / 1024 / 1024 ) . toFixed ( 2 ) } MB / ${ (
179183 heap . heapCapacity /
@@ -266,7 +270,7 @@ const commands: Record<string, Command> = {
266270 description :
267271 "Track a channel to get notified when they upload a video!" ,
268272 integration_types : [ 0 , 1 ] ,
269- contexts : [ 0 , 1 , 2 ] ,
273+ contexts : [ 0 , 1 ] ,
270274 } ,
271275 execute : async ( interaction : CommandInteraction ) => {
272276 // Get the YouTube Channel ID
0 commit comments