npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

telegram-log

v0.4.0

Published

Send log from your project directly on telegram, any backend or webHook needed

Downloads

9

Readme

telegram-log

Send the log from your project directly on telegram, no backend or webHook needed!

You can use two different template or you can easily create and use your own too.

Install

npm install --save telegram-log

Use @botfather to generate your bot and @get_userId_bot to know your user id.

Note

Remember that users in the receiverList must have /started your bot to be able to receive messages!

Example

Basic usage

const tLog = require('telegram-log').init({
	token: 'TELEGRAM_BOT_TOKEN',
	receivers: 'TELEGRAM_USER_ID'
});

tLog.info('User login');
tLog.warning('Hard disk is almost full');
tLog.error('Internal Server Error',500);
tLog.debug('hello guy',123);

Custom options

const tLog = require('telegram-log');

const options = {
	token: 'TELEGRAM_BOT_TOKEN',
	receivers: 'TELEGRAM_USER_ID',
	dateFormat: 'd/mm/yy, H:MM:ss',
};

tLog.init(options);

//you can add custom options just for the single log
tLog.info('User login on https://facebook.com', { disableLinkPreview: true, template: '{{emojiType}}{{text}}' } );
tLog.warning('Hardisk `Games` is almost full', { mode: 'Markdown', silent: true, template: 'minimal' } );
tLog.error('<b>Internal Server Error</b>', 500, { mode: 'HTML' } );
tLog.debug('hello guy', { template: false } );

Result

example image

Documentation

Options

| Parameter | Type | Description | Required | | ------ | ------ | ------ | ------ | | token | string | telegram bot token (get your bot's from @botfather) | required | | receivers | string/Array | user ids that will receive message, (get yours from @get_userId_bot) | required | | projectName | string | project name if you need to distinguish them when you use same bot for multiple projects or applications | optional (default "") | | mode | string | message format, can be "text", "html", "markdown" | optional (default "text") | | dateFormat | string | represents the format of the date, uses dateformat | optional (default "d/mm/yyyy, HH:MM:ss") | | silent | bool | send the message without a notification | optional (default false) | | disableLinkPreview | bool | disable preLoading urls inside the telegram chat | optional (default false) | | template | string/bool | can use to select template ("default" or "minimal") or create your custom template, set it false to disable template | optional (default "default") |

Template

If you don't like the default or minimal templates you can create and use your own with the options's parameter.

Use double curly braces to add variables to your template like {{date}} or {{projectName}}.

Accepted names for variables are :

  • text
  • code
  • projectName
  • date
  • type (info, warning, error, debug)
  • emojiType (:speech_balloon:, :warning:, :bangbang:, :beetle:)