Skip to content

Commit

Permalink
Merge branch 'main' into all-contributors/add-shevernitskiy
Browse files Browse the repository at this point in the history
  • Loading branch information
KnorpelSenf authored Oct 14, 2023
2 parents 0ceba71 + 469a736 commit 55ba416
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export class Bot<
) {
if (this.me === undefined) {
throw new Error(
"Bot not initialized! Either call `await bot.init()`, \
"Bot not initialized! Either call `await bot.init()`, \

Check warning on line 333 in src/bot.ts

View check run for this annotation

Codecov / codecov/patch

src/bot.ts#L333

Added line #L333 was not covered by tests
or directly set the `botInfo` option in the `Bot` constructor to specify \
a known bot info object.",
);
Expand Down
10 changes: 10 additions & 0 deletions src/convenience/frameworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,15 @@ const worktop: FrameworkAdapter = (req, res) => ({
unauthorized: () => res.send(401, WRONG_TOKEN_ERROR),
});

/** nhttp web framework */
const nhttp: FrameworkAdapter = (rev) => ({
update: rev.body,
header: rev.headers.get(SECRET_HEADER) || undefined,
end: () => rev.response.sendStatus(200),
respond: (json) => rev.response.status(200).send(json),
unauthorized: () => rev.response.status(401).send(WRONG_TOKEN_ERROR),
});

Check warning on line 350 in src/convenience/frameworks.ts

View check run for this annotation

Codecov / codecov/patch

src/convenience/frameworks.ts#L343-L350

Added lines #L343 - L350 were not covered by tests

// Please open a PR if you want to add another adapter
export const adapters = {
express,
Expand All @@ -359,4 +368,5 @@ export const adapters = {
"cloudflare-mod": cloudflareModule,
hono,
worktop,
nhttp,
};

0 comments on commit 55ba416

Please sign in to comment.