Skip to main content
Home
This package works with BunIt is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
This package works with Bun
It is unknown whether this package works with Browsers
JSR Score
58%
Published
11 months ago (0.0.5)

Introduction

  • Simple logger for Telegram

How to use

  1. Install package
bunx jsr add @alexgalhardo/telegram-logger
  1. 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
  2. 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
  3. 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

Screenshot 2024-06-14 at 12 54 18

License

MIT

Copyright (c) June 2024-present, Alex Galhardo

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@alexgalhardo/telegram-logger

Import symbol

import * as telegram_logger from "@alexgalhardo/telegram-logger";
or

Import directly with a jsr specifier

import * as telegram_logger from "jsr:@alexgalhardo/telegram-logger";

Add Package

pnpm i jsr:@alexgalhardo/telegram-logger
or (using pnpm 10.8 or older)
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
or (using Yarn 4.8 or older)
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";