Skip to content

Commit

Permalink
Cast code to LanguageCode model
Browse files Browse the repository at this point in the history
  • Loading branch information
chiliec committed Jun 18, 2024
1 parent a282d3e commit d776f31
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/bot/handlers/commands/setcommands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BotCommand } from "@grammyjs/types";
import { BotCommand, LanguageCode } from "@grammyjs/types";
import { CommandContext } from "grammy";
import { i18n, isMultipleLocales } from "#root/bot/i18n.js";
import { config } from "#root/config.js";
Expand Down Expand Up @@ -112,7 +112,7 @@ export async function setCommandsHandler(ctx: CommandContext<Context>) {
: []),
],
{
language_code: code,
language_code: code as LanguageCode,
scope: {
type: "all_private_chats",
},
Expand All @@ -133,7 +133,7 @@ export async function setCommandsHandler(ctx: CommandContext<Context>) {
if (isMultipleLocales) {
const requests = i18n.locales.map((code) =>
ctx.api.setMyCommands(getGroupChatCommands(code), {
language_code: code,
language_code: code as LanguageCode,
scope: {
type: "all_group_chats",
},
Expand All @@ -146,14 +146,14 @@ export async function setCommandsHandler(ctx: CommandContext<Context>) {
// when the chat is empty
const descriptionRequests = i18n.locales.map((code) =>
ctx.api.setMyDescription(i18n.t(code, "bot.description"), {
language_code: code,
language_code: code as LanguageCode,
}),
);

// bot's profile page and in share links
const shortDescriptionRequests = i18n.locales.map((code) =>
ctx.api.setMyShortDescription(i18n.t(code, "bot.short_description"), {
language_code: code,
language_code: code as LanguageCode,
}),
);
await Promise.all([
Expand Down
14 changes: 7 additions & 7 deletions src/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d776f31

Please sign in to comment.