Skip to content

Commit

Permalink
updated bot.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
GhomKrosmonaute committed Jun 26, 2024
1 parent 77c8a0e commit 3f61441
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export const orm = new ORM({
logger,
})

export * from "@ghom/orm"
export * from "@ghom/orm"
10 changes: 6 additions & 4 deletions src/app/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import * as logger from "./logger.ts"
import * as config from "./config.ts"
import * as client from "./client.ts"

const _env = env ?? process.env

export type PermissionsNames = keyof typeof v10.PermissionFlagsBits

export async function checkUpdates() {
Expand Down Expand Up @@ -86,10 +88,10 @@ export async function checkUpdates() {
}
}

const locale = env?.BOT_LOCALE ?? "en"
const locale = _env.BOT_LOCALE

import(`dayjs/locale/${locale}.js`)
.then(() => dayjs.locale(locale))
import(`dayjs/locale/${locale ?? "en"}.js`)
.then(() => dayjs.locale(locale ?? "en"))
.catch(() =>
logger.warn(
`The ${chalk.bold(
Expand All @@ -104,7 +106,7 @@ dayjs.extend(timezone)
dayjs.extend(toObject)
dayjs.utc(1)

if (env.BOT_TIMEZONE) dayjs.tz.setDefault(env.BOT_TIMEZONE)
if (_env.BOT_TIMEZONE) dayjs.tz.setDefault(_env.BOT_TIMEZONE)

export { dayjs }

Expand Down

0 comments on commit 3f61441

Please sign in to comment.