- improved bun support - deno support - use antfu/eslint-config - fixed some issues - removed pre-commit hooks
24 lines
624 B
Handlebars
24 lines
624 B
Handlebars
{{emit_if features.typescript}}
|
|
{{#if (eq runtime "deno")}}
|
|
import '@std/dotenv/load'
|
|
|
|
const API_ID = Number.parseInt(Deno.env.get('API_ID')!)
|
|
const API_HASH = Deno.env.get('API_HASH')!
|
|
{{#if botToken}}
|
|
const BOT_TOKEN = Deno.env.get('BOT_TOKEN')!
|
|
{{/if}}
|
|
{{else}}
|
|
import process from 'node:process'
|
|
|
|
const API_ID = Number.parseInt(process.env.API_ID!)
|
|
const API_HASH = process.env.API_HASH!
|
|
{{#if botToken}}
|
|
const BOT_TOKEN = process.env.BOT_TOKEN!
|
|
{{/if}}
|
|
{{/if}}
|
|
|
|
if (Number.isNaN(API_ID) || !API_HASH) {
|
|
throw new Error('API_ID or API_HASH not set!')
|
|
}
|
|
|
|
export { API_HASH, API_ID{{#if botToken}}, BOT_TOKEN{{/if}} }
|