mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-25 03:49:11 +00:00
fix: missing tools on a composable handler
This commit is contained in:
parent
76a03c2d2c
commit
d5acea4abb
1 changed files with 55 additions and 52 deletions
|
@ -17,7 +17,7 @@ import {
|
||||||
SessionData,
|
SessionData,
|
||||||
UserGuildPermissions,
|
UserGuildPermissions,
|
||||||
} from '@roleypoly/types';
|
} from '@roleypoly/types';
|
||||||
import { AuthType, discordFetch, Handler } from '@roleypoly/worker-utils';
|
import { AuthType, discordFetch, Handler, HandlerTools } from '@roleypoly/worker-utils';
|
||||||
import { cacheLayer, CacheLayerOptions, isRoot, withSession } from './api-tools';
|
import { cacheLayer, CacheLayerOptions, isRoot, withSession } from './api-tools';
|
||||||
import { botClientID, botToken } from './config';
|
import { botClientID, botToken } from './config';
|
||||||
import { GuildData, Guilds } from './kv';
|
import { GuildData, Guilds } from './kv';
|
||||||
|
@ -229,7 +229,9 @@ export const asEditor = (
|
||||||
options: AsEditorOptions = {},
|
options: AsEditorOptions = {},
|
||||||
wrappedHandler: (session: SessionData, userGuildContext: UserGuildContext) => Handler
|
wrappedHandler: (session: SessionData, userGuildContext: UserGuildContext) => Handler
|
||||||
): Handler =>
|
): Handler =>
|
||||||
withSession((session: SessionData) => async (request: Request): Promise<Response> => {
|
withSession(
|
||||||
|
(session: SessionData) =>
|
||||||
|
async (request: Request, tools: HandlerTools): Promise<Response> => {
|
||||||
const { rateLimitKey, rateLimitTimeoutSeconds } = options;
|
const { rateLimitKey, rateLimitTimeoutSeconds } = options;
|
||||||
const url = new URL(request.url);
|
const url = new URL(request.url);
|
||||||
const [, , guildID] = url.pathname.split('/');
|
const [, , guildID] = url.pathname.split('/');
|
||||||
|
@ -282,5 +284,6 @@ export const asEditor = (
|
||||||
guildID,
|
guildID,
|
||||||
guild,
|
guild,
|
||||||
url,
|
url,
|
||||||
})(request);
|
})(request, tools);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue