Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tg-resolve

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tg-resolve - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

example.js

13

index.js

@@ -0,1 +1,12 @@

/***
* tg-resolve
*
* A light Node.js Library that resolves Telegram usernames and/or ids to a complete User or/and Chat JSON object(s)
*
* Mohammed Sohail <sohailsameja@gmail.com>
*
* Released Under MIT License
*
***/
'use-strict';

@@ -18,3 +29,3 @@

request({
uri: url + token + '/' + method + '?' + type + '=@' + chatId,
uri: url + token + '/' + method + '?' + type + '=' + chatId,
json: true

@@ -21,0 +32,0 @@ }, function (error, response, body) {

2

package.json
{
"name": "tg-resolve",
"version": "1.0.0",
"version": "1.1.0",
"description": "Resolves Telegram usernames and/or ids to a complete User or/and Chat JSON object(s)",

@@ -5,0 +5,0 @@ "main": "index.js",

[![](https://img.shields.io/npm/dt/tg-resolve.svg?style=flat-square)](https://www.npmjs.com/package/tg-resolve)
[![https://telegram.me/kamikazechaser](https://img.shields.io/badge/%F0%9F%92%AC_Telegram-kamikazechaser-blue.svg?style=flat-square)](https://telegram.me/kamikazechaser)
[![https://github.com/kamikazechaser/rangi/blob/master/LICENSE.md](https://img.shields.io/badge/license-MIT-lightgreen.svg?style=flat-square)](https://github.com/kamikazechaser/rangi/blob/master/LICENSE)
[![Dependency Status](https://img.shields.io/david/kamikazechaser/tg-resolve.svg?style=flat-square)](https://david-dm.org/kamikazechaser/tg-resolve)
[![https://telegram.me/UResolverBot](https://img.shields.io/badge/%F0%9F%92%AC_Telegram-TheResolverBot-blue.svg?style=flat-square)](https://telegram.me/UResolverBot)
> 👤 tg-resolve
A light Node.js Library that reolves Telegram usernames and/or ids to a complete User or/and Chat JSON object(s)
A light Node.js Library that resolves Telegram usernames and/or ids to a complete User or/and Chat JSON object(s)

@@ -12,11 +14,12 @@ > Powered by pwrtelegramapi

The official Telegram API does not allow bots to resolve usernames/ids out of the box. One is forced to create his/her own database so as to resolve usernames. Resolving of usernames is particularly useful in that a bot is able to get a user/chat id of a person or groub it hasn't even seen! Unlike before where a bot is only able to see a person if it has ever recieved his/her message whether in private or in a group.
The official Telegram API **does not** allow bots to resolve usernames/ids out of the box. One is forced to create his/her own database so as to resolve usernames. Resolving of usernames is particularly useful in that a bot is able to get a user/chat id of a person or groub it hasn't even seen! Unlike before where a bot is only able to see a person if it has ever recieved his/her message whether in private or in a group.
### Useful Scenarios
## Useful Scenarios
- Group Administration Bots
- Bot Which Has Lost Its Database, but users had previously started the bot
- Resolving Group/Channel Ids
- And Much More!
- Group administration bots
- BIn a bot which has lost its database, but users had previously started the bot
- General resolving to get user details
- And much more!
## Install

@@ -27,22 +30,47 @@

```
## Usage
_Refer to [example.js](https://github.com/kamikazechaser/tg-resolve/blob/master/example.js) for a more comprehensive guide_
```javascript
var resUser = require(tg-resolve);
resUser('kamikazechaser', function(err, u){
resUser('@kamikazechaser', function(err, u){
console.log(u);
/* A JSON Object Is Returned
// A JSON Object Is Returned
{
id: 135207785,
first_name: 'Kamikaze Chaser',
username: 'kamikazechaser',
type: 'private',
last_name: ''
}
*/
});
```
## JSON Object Structure
_When resolving for a Group/Channel_
```javascript
{
id: -1001065761006,
title: "End Of The World Party",
username: "EOTWGroup",
type: "supergroup",
when: "2016-10-18 11:22:56"
}
```
_When resolving for a User_
```javascript
{
id: 58258161,
first_name: "John",
username: "john_doe",
type: "private",
last_name: "Doe",
when: "2016-10-18 11:22:56"
}
```
## Issues And Contribution
Fork the repository and submit a pull request for whatever change you want to be added to this project. If you have any questions, just open an issue.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc