Skip to content

Commit

Permalink
feat: support grammY lazy sessions (#10)
Browse files Browse the repository at this point in the history
* Added support for grammY lazy sessions

Signed-off-by: Slava Fomin II <slava@fomin.io>

* style: adapt to linter style

Co-authored-by: EdJoPaTo <rfc-conform-git-commit-email@funny-long-domain-label-everyone-hates-as-it-is-too-long.edjopato.de>
  • Loading branch information
slavafomin and EdJoPaTo authored Nov 23, 2021
1 parent 1f07f15 commit 6afda2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"url": "https://edjopato.de"
},
"contributors": [
"Vitaly Domnikov <oss@vitaly.codes>"
"Vitaly Domnikov <oss@vitaly.codes>",
"Slava Fomin II <slava@fomin.io>"
],
"scripts": {
"build": "del-cli dist && tsc",
Expand Down
2 changes: 1 addition & 1 deletion source/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class I18n {
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
return async (ctx, next) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const session: Session | undefined = this.config.useSession && (ctx as any)[this.config.sessionName];
const session: Session | undefined = await (this.config.useSession && (ctx as any)[this.config.sessionName]);
const languageCode = session?.__language_code ?? ctx.from?.language_code ?? this.config.defaultLanguage;

// @ts-expect-error writing to readonly property
Expand Down

0 comments on commit 6afda2c

Please sign in to comment.