This package works with BunIt is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Browsers




JSR Score
58%
Published
11 months ago (0.0.5)
Introduction
- Simple logger for Telegram
How to use
- Install package
bunx jsr add @alexgalhardo/telegram-logger
-
Getting
TELEGRAM_BOT_HTTP_TOKEN
- Find BotFather in Telegram to create new bots
- Start a conversation with BotFather typing:
/newbot
- Create a name and username for your new bot
- Save the
TELEGRAM_BOT_HTTP_TOKEN
BotFather will answer to you - BotFather will also give you the link to start conversation with your new bot:
t.me/YOUR_BOT_NAME
-
Getting
TELEGRAM_BOT_CHANNEL_ID
- Send a aleatory message to your new bot you created previously
- Access:
https://api.telegram.org/bot<YOUR_TELEGRAM_BOT_HTTP_TOKEN_HERE>/getUpdates
- Copy and save:
chat.id
its a number
-
Create logger
import TelegramLogger from "@alexgalhardo/telegram-logger"; const logger = new TelegramLogger(TELEGRAM_BOT_HTTP_TOKEN, TELEGRAM_BOT_CHANNEL_ID); logger.error('Something went wrong'); logger.info('Some info message');
Example
License
Copyright (c) June 2024-present, Alex Galhardo
Add Package
deno add jsr:@alexgalhardo/telegram-logger
Import symbol
import * as telegram_logger from "@alexgalhardo/telegram-logger";
Import directly with a jsr specifier
import * as telegram_logger from "jsr:@alexgalhardo/telegram-logger";
Add Package
pnpm i jsr:@alexgalhardo/telegram-logger
pnpm dlx jsr add @alexgalhardo/telegram-logger
Import symbol
import * as telegram_logger from "@alexgalhardo/telegram-logger";
Add Package
yarn add jsr:@alexgalhardo/telegram-logger
yarn dlx jsr add @alexgalhardo/telegram-logger
Import symbol
import * as telegram_logger from "@alexgalhardo/telegram-logger";
Add Package
npx jsr add @alexgalhardo/telegram-logger
Import symbol
import * as telegram_logger from "@alexgalhardo/telegram-logger";
Add Package
bunx jsr add @alexgalhardo/telegram-logger
Import symbol
import * as telegram_logger from "@alexgalhardo/telegram-logger";