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

vue-telegram-plugin

v1.0.2

Published

<h1 align="center"><b>Vue Telegram Plugin</b></h1> <h4 align="center">A plugin for Vue support authorize and send message in telegram</h4> <h5 align="center">No dependencies, just <a href="https://www.npmjs.com/package/tdweb">tdweb</a>(99% size)</h5>

Downloads

28

Readme

Installation

# Yarn
yarn add vue-telegram-plugin

# Npm
npm install vue-telegram-plugin

Usage

Prepare tdweb library

This plugin using tdweb (Telegram Data Libraty - TDLib in browser), so after installing you have to make all tdweb's files loadable from your server. For example you can copy all file in vue-telegram-plugin/lib folder into the server's public folder.

cp -r node_modules/vue-telegram-plugin/lib/* public/

Create your Telegram Application

For using telegram API you must register an application. You could easily create application at https://my.telegram.org/apps

Loading the plugin

import Vue from 'vue'
import VueTelegram from 'vue-telegram-plugin'

Vue.use(VueTelgram, options)

Available options

Name | Data Type | Descroption --------------------- | ----------- | ----------- useTestDC | Boolean | If set to true, the Telegram test environment will be used instead of the production environment. Default: true logVerbosityLevel | Number | The initial verbosity level for the TDLib internal logging (0-1023). Default: 1 jsLogVerbosityLevel | Number | The initial verbosity level of the JavaScript part of the code. Default: 3 useDatabase | Boolean | Default: false. If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. apiId | String(required) | Application identifier for Telegram API access, which can be obtained at https://my.telegram.org. apiHash | String(required) | Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org. system_language_code| String | IETF language tag of the user's operating system language. Default en database_directory | String | The path to the directory for the persistent database. Default: /telegramdb

Available methods

Methods that are register on vue $vTelegram instance. For first, call init method to initialize telegram service.

Vue.$vTelegram.init()

Method | Params | Descroption ------------------------- | ----------------------------------- | ----------- init | | Initialize telegram service login | phoneNumber(String) | Login with phone number confirmVerificationCode | verificationCode(String) | Confirm the verification code getMe | | Get logged user information searchChats | {   query(String),   limit(Number)} | Search chat's title match query with limit results sendMessage | {   chatId(String),   message(String) } | Send message to chat with chatId logout | | Logout user

Available events

Events that are emmited on the vue $vTelegramBus instance (Event Bus).

// Listening an event.
Vue.$vTelegramBus.on(event, () => {})

// Remove one or move event.
Vue.$vTelegramBus.off(event, () => {})

// Listen for the given event once.
Vue.$vTelegramBus.once(event, () => {})

// Emit an event.
Vue.$vTelegramBus.once(event, ...args)

Event | Argurments | Descroption ----------------------------------- | ----------------------------------- | ----------- authorizationStateWaitPhoneNumber | | Telegram need the user's phone number to authorize. Call $vTelegram.login method to provice the phone number. authorizationStateWaitCode | | Telegram need the the user's authentication code to authorize. Call $vTelegram.confirmVerificationCode method to provice the authenticateion code. authorizationStateReady | | The user has been successfully authorized. VueTelegram is now ready to use such as $vTelegram.getMe() ...

Auth component

If you don't want to create your auth component you can use VueTelegramAuth that registered global. This component is a dialog contain phone and verification code submit's form to authenticate user. Simple to use no parameters required. To use the component, you have to install ElementUI

<VueTelegramAuth />