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

ts-telegraf-decorators

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-telegraf-decorators - npm Package Compare versions

Comparing version 0.2.6 to 0.3.0

96

build/src/decorators.js

@@ -81,2 +81,74 @@ "use strict";

exports.Start = Start;
function Settings() {
return function (target, propertyKey, descriptor) {
MetadataStorage_1.MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target: target,
type: "settings",
data: []
});
return descriptor;
};
}
exports.Settings = Settings;
function Entity(entity) {
return function (target, propertyKey, descriptor) {
MetadataStorage_1.MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target: target,
type: "entity",
data: [entity]
});
return descriptor;
};
}
exports.Entity = Entity;
function Mention(username) {
return function (target, propertyKey, descriptor) {
MetadataStorage_1.MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target: target,
type: "mention",
data: [username]
});
return descriptor;
};
}
exports.Mention = Mention;
function Phone(phone) {
return function (target, propertyKey, descriptor) {
MetadataStorage_1.MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target: target,
type: "phone",
data: [phone]
});
return descriptor;
};
}
exports.Phone = Phone;
function Hashtag(hashtag) {
return function (target, propertyKey, descriptor) {
MetadataStorage_1.MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target: target,
type: "hashtag",
data: [hashtag]
});
return descriptor;
};
}
exports.Hashtag = Hashtag;
function Cashtag(cashtag) {
return function (target, propertyKey, descriptor) {
MetadataStorage_1.MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target: target,
type: "cashtag",
data: [cashtag]
});
return descriptor;
};
}
exports.Cashtag = Cashtag;
function Help() {

@@ -154,2 +226,26 @@ return function (target, propertyKey, descriptor) {

exports.Action = Action;
function InlineQuery(inlineQuery) {
return function (target, propertyKey, descriptor) {
MetadataStorage_1.MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target: target,
type: "inlineQuery",
data: [inlineQuery]
});
return descriptor;
};
}
exports.InlineQuery = InlineQuery;
function GameQuery() {
return function (target, propertyKey, descriptor) {
MetadataStorage_1.MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target: target,
type: "gameQuery",
data: []
});
return descriptor;
};
}
exports.GameQuery = GameQuery;
function Leave() {

@@ -156,0 +252,0 @@ return function (target, propertyKey, descriptor) {

10

build/types/src/decorators.d.ts

@@ -14,2 +14,8 @@ import * as tt from "telegraf/typings/telegram-types";

export declare function Start(): Function;
export declare function Settings(): Function;
export declare function Entity(entity: string | string[] | RegExp | RegExp[] | Function): Function;
export declare function Mention(username: string | string[]): Function;
export declare function Phone(phone: string | string[]): Function;
export declare function Hashtag(hashtag: string | string[]): Function;
export declare function Cashtag(cashtag: string | string[]): Function;
export declare function Help(): Function;

@@ -20,3 +26,5 @@ export declare function On(event: tt.UpdateType | tt.UpdateType[] | tt.MessageSubTypes | tt.MessageSubTypes[]): Function;

export declare function Enter(): Function;
export declare function Action(action: string | RegExp): Function;
export declare function Action(action: string | string[] | RegExp | RegExp[]): Function;
export declare function InlineQuery(inlineQuery: string | string[] | RegExp | RegExp[]): Function;
export declare function GameQuery(): Function;
export declare function Leave(): Function;

@@ -23,0 +31,0 @@ export declare const TFContext: () => (target: any, propertyKey: string, parameterIndex: number) => void;

2

build/types/src/metadata/HandlerMetadata.d.ts
export interface HandlerMetadata {
type: 'start' | 'command' | 'help' | 'hears' | 'on' | 'leave' | 'enter' | 'action';
type: string;
target: Object;

@@ -4,0 +4,0 @@ propertyName: string;

{
"name": "ts-telegraf-decorators",
"version": "0.2.6",
"version": "0.3.0",
"author": "Ivan Surkov <panarama360@gmail.com>",

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

@@ -81,2 +81,76 @@ import * as tt from "telegraf/typings/telegram-types";

export function Settings(): Function {
return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {
MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target,
type: "settings",
data: []
});
return descriptor;
}
}
export function Entity(entity: string | string[] | RegExp | RegExp[] | Function): Function {
return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {
MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target,
type: "entity",
data: [entity]
});
return descriptor;
}
}
export function Mention(username: string | string[]): Function {
return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {
MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target,
type: "mention",
data: [username]
});
return descriptor;
}
}
export function Phone(phone: string | string[]): Function {
return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {
MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target,
type: "phone",
data: [phone]
});
return descriptor;
}
}
export function Hashtag(hashtag: string | string[]): Function {
return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {
MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target,
type: "hashtag",
data: [hashtag]
});
return descriptor;
}
}
export function Cashtag(cashtag: string | string[]): Function {
return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {
MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target,
type: "cashtag",
data: [cashtag]
});
return descriptor;
}
}
export function Help(): Function {

@@ -143,3 +217,3 @@ return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {

export function Action(action: string | RegExp): Function {
export function Action(action: string | string[] | RegExp | RegExp[]): Function {
return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {

@@ -156,3 +230,27 @@

}
export function InlineQuery(inlineQuery: string | string[] | RegExp | RegExp[]): Function {
return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {
MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target,
type: "inlineQuery",
data: [inlineQuery]
});
return descriptor;
}
}
export function GameQuery(): Function {
return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {
MetadataArgsStorage.handlers.push({
propertyName: propertyKey,
target,
type: "gameQuery",
data: []
});
return descriptor;
}
}
export function Leave(): Function {

@@ -159,0 +257,0 @@ return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {

export interface HandlerMetadata {
type: 'start' | 'command' | 'help' | 'hears' | 'on' | 'leave' | 'enter' | 'action' ,
type: string ,
target: Object,

@@ -5,0 +5,0 @@ propertyName: string,

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