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

vv-telegram

v0.2.1

Published

JavaScript (NodeJs): api for create telegram bot, based on https://github.com/telegraf/telegraf

Downloads

7

Readme

Install & Use

npm i vv-telegram
const os = require('os')
const vvt = require('vv-telegram')
let bot = vvt.create('YOUR_TOKEN_BOT', {cache: {hours_life: 3}})

let t1 = 'short_text'
let t2 = 'long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text_long_text'

bot.start(error => {
    if (error) {
        console.log(error)
        process.exit()
    }
    console.log('BOT STARTED')

    bot.on_error(error => {
        console.log('ERROR IN BOT WORK:')
        console.log(error)
    })
    bot.on_message(message => {
        console.log(''.concat('message.message_id:', os.EOL, message.message_id, os.EOL, 'message.type_text:', os.EOL, message.type_text, os.EOL, 'message.text:', os.EOL, message.text))

        //demo delete prev message when user click on button in prev message
        let prev_file_find = false
        let prev_message = bot.get_from_cache_receiving({account: message.account, chat_id: message.chat_id, message_id: message.message_id, type_text: 'callback_data'})
        prev_message.forEach(m => {
            bot.message_delete(message.chat_id, m.message_id)
            prev_file_find = true
        })


        /** @type {vvt.package_sending_button[][]}  */
        let buttons = [
            [
                {text: 'b1', callback_data: '1_'.concat(t1)}, {text: 'b2', callback_data: '2_'.concat(t1)}, {text: 'b3', callback_data: '3_'.concat(t1)},
            ], [
                {text: 'b4', callback_data: '4_'.concat(t2)}, {text: 'b5', callback_data: '5_'.concat(t2)}, {text: 'b6', callback_data: '6_'.concat(t2)},
            ]
        ]

        let message_text = message.error ? 'ERROR: '.concat(message.error) : 'replay for '.concat(message.text)

        bot.message_send(
            message.account,
            message_text,
            {buttons: buttons, reply_to_message_id: prev_file_find ? undefined : message.message_id},
            undefined,
            (error, sending) => {
                if (error) {
                    console.log(error)
                    return
                }

                //demo edit prev message
                setTimeout(() => {
                    bot.message_send(
                        message.account,
                        'edited: '.concat(message_text),
                        {reply_to_message_id: message.message_id, buttons: buttons},
                        sending.message_id,
                        (error, sending) => {
                            if (error) {
                                console.log(error)
                                return
                            }
                        }
                    )
                }, 5000)
            }
        )
    })
})

Functions

Typedefs

create(token, [options]) ⇒ app

Kind: global function

| Param | Type | | --- | --- | | token | string | | [options] | type.options |

button_line_to_matrix(button_line, width) ⇒ Array.<Array.<package_sending_button>>

Kind: global function

| Param | Type | | --- | --- | | button_line | Array.<package_sending_button> | | width | number |

button_line_to_matrix~result : Array.<Array.<package_sending_button>>

Kind: inner typedef of button_line_to_matrix

button_line_to_matrix~line : Array.<package_sending_button>

Kind: inner typedef of button_line_to_matrix

bot : app

Kind: global typedef

package_sending_button : type.package_sending_button

Kind: global typedef

package_sending_menu : type.package_sending_menu

Kind: global typedef

package_sending_options : type.package_sending_options

Kind: global typedef

package_sending_text_format : type.package_sending_text_format

Kind: global typedef

package_receiving : type.package_receiving

Kind: global typedef

package_sending : type.package_sending

Kind: global typedef

package_sending_queue : type.package_sending_queue

Kind: global typedef

file_info : type.file_info

Kind: global typedef