@@ -44,7 +44,7 @@ export async function createGuildRole(
44
44
body : JSON . stringify ( data ) ,
45
45
} ) ;
46
46
if ( response . ok ) {
47
- return ( await response . json ( ) ) as string | guildRoleResponse ;
47
+ return await response . json ( ) ;
48
48
} else {
49
49
return INTERNAL_SERVER_ERROR ;
50
50
}
@@ -125,7 +125,7 @@ export async function getGuildRoles(env: env): Promise<Array<Role>> {
125
125
throw new Error ( ROLE_FETCH_FAILED ) ;
126
126
}
127
127
128
- const guildRoles : Array < GuildRole > = ( await response . json ( ) ) as GuildRole [ ] ;
128
+ const guildRoles : Array < GuildRole > = await response . json ( ) ;
129
129
130
130
return guildRoles . map ( ( role ) => ( {
131
131
id : role . id ,
@@ -143,7 +143,6 @@ export async function getGuildRoleByName(
143
143
const roles = await getGuildRoles ( env ) ;
144
144
return roles ?. find ( ( role ) => role . name === roleName ) ;
145
145
}
146
- import { Response } from "@cloudflare/workers-types" ;
147
146
148
147
export async function mentionEachUserInMessage ( {
149
148
message,
@@ -174,12 +173,10 @@ export async function mentionEachUserInMessage({
174
173
content : `${ message ? message + " " : "" } ${ userId } ` ,
175
174
} ) ,
176
175
} ) . then ( ( response ) => {
177
- const rateLimitRemaining = parseRateLimitRemaining (
178
- response as unknown as Response
179
- ) ;
176
+ const rateLimitRemaining = parseRateLimitRemaining ( response ) ;
180
177
if ( rateLimitRemaining === 0 ) {
181
178
waitTillNextAPICall = Math . max (
182
- parseResetAfter ( response as unknown as Response ) ,
179
+ parseResetAfter ( response ) ,
183
180
waitTillNextAPICall
184
181
) ;
185
182
}
0 commit comments