File tree 4 files changed +20
-15
lines changed
4 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -24,15 +24,6 @@ enum Constants {
24
24
var id : ChannelSnowflake {
25
25
self . rawValue
26
26
}
27
-
28
- static func reportingChannel( repoID: Int ) -> Self {
29
- switch repoID {
30
- case 64560805 :
31
- return . documentation
32
- default :
33
- return . issueAndPRs
34
- }
35
- }
36
27
}
37
28
38
29
enum Roles : RoleSnowflake {
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ struct IssueHandler: Sendable {
96
96
issue: embedIssue,
97
97
repo: embedRepo
98
98
) ,
99
+ createdAt: self . issue. created_at,
99
100
repoID: self . repo. id,
100
101
number: self . issue. number
101
102
)
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ struct PRHandler {
79
79
try TicketReporter (
80
80
context: self . context,
81
81
embed: await self . createReportEmbed ( ) ,
82
+ createdAt: self . pr. created_at,
82
83
repoID: self . repo. id,
83
84
number: self . event. number. requireValue ( )
84
85
)
Original file line number Diff line number Diff line change @@ -5,15 +5,11 @@ import struct Foundation.Date
5
5
struct TicketReporter {
6
6
let context : HandlerContext
7
7
let embed : Embed
8
+ let createdAt : Date
8
9
let repoID : Int
9
10
let number : Int
10
11
var channel : Constants . Channels {
11
- /// The change to use `.reportingChannel(repoID:)` was made only after this timestamp.
12
- if Date ( ) . timeIntervalSince1970 < 1_696_067_000 {
13
- return . issueAndPRs
14
- } else {
15
- return . reportingChannel( repoID: repoID)
16
- }
12
+ . reportingChannel( repoID: repoID, createdAt: createdAt)
17
13
}
18
14
19
15
func reportCreation( ) async throws {
@@ -95,3 +91,19 @@ struct TicketReporter {
95
91
try response. guardSuccess ( )
96
92
}
97
93
}
94
+
95
+ private extension Constants . Channels {
96
+ static func reportingChannel( repoID: Int , createdAt: Date ) -> Self {
97
+ /// The change to use `.documentation` was made only after this timestamp.
98
+ if createdAt. timeIntervalSince1970 < 1_696_067_000 {
99
+ return . issueAndPRs
100
+ } else {
101
+ switch repoID {
102
+ case 64560805 :
103
+ return . documentation
104
+ default :
105
+ return . issueAndPRs
106
+ }
107
+ }
108
+ }
109
+ }
You can’t perform that action at this time.
0 commit comments