File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ const { DiscordSnowflake } = require ( '@sapphire/snowflake' ) ;
3
4
const { InteractionType } = require ( 'discord-api-types/v10' ) ;
4
5
const { DiscordjsError, ErrorCodes } = require ( '../errors' ) ;
5
6
@@ -21,6 +22,24 @@ class InteractionResponse {
21
22
this . client = interaction . client ;
22
23
}
23
24
25
+ /**
26
+ * The timestamp the interaction response was created at
27
+ * @type {number }
28
+ * @readonly
29
+ */
30
+ get createdTimestamp ( ) {
31
+ return DiscordSnowflake . timestampFrom ( this . id ) ;
32
+ }
33
+
34
+ /**
35
+ * The time the interaction response was created at
36
+ * @type {Date }
37
+ * @readonly
38
+ */
39
+ get createdAt ( ) {
40
+ return new Date ( this . createdTimestamp ) ;
41
+ }
42
+
24
43
/**
25
44
* Collects a single component interaction that passes the filter.
26
45
* The Promise will reject if the time expires.
Original file line number Diff line number Diff line change @@ -555,6 +555,8 @@ export class InteractionResponse<Cached extends boolean = boolean> {
555
555
public interaction : Interaction < WrapBooleanCache < Cached > > ;
556
556
public client : Client ;
557
557
public id : Snowflake ;
558
+ public get createdAt ( ) : Date ;
559
+ public get createdTimestamp ( ) : number ;
558
560
public awaitMessageComponent < T extends MessageComponentType > (
559
561
options ?: AwaitMessageCollectorOptionsParams < T , Cached > ,
560
562
) : Promise < MappedInteractionTypes < Cached > [ T ] > ;
You can’t perform that action at this time.
0 commit comments