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.0.8 to 0.1.0

6

build/sample/app.js

@@ -7,8 +7,8 @@ "use strict";

var typedi_1 = require("typedi");
src_1.buildBot({
token: '399545821:AAFpnISF29hakXMgBaP37at-ZuS8JEkyp9o',
var bot = src_1.buildBot({
token: '<TOKEN>',
container: typedi_1.Container,
// bot: bot bot instance
// session: session() custom session
controllers: [__dirname + '/controllers/**.js'],
controllers: [__dirname + '/controllers/**.ts'],
}).startPolling();

@@ -29,4 +29,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -55,33 +55,5 @@ case 0: case 1: t = op; break;

var telegraf_1 = require("telegraf");
//Controller Example
var ControllerTest = /** @class */ (function () {
function ControllerTest() {
}
ControllerTest.prototype.start1 = function (ctx) {
ctx.reply('Hello start1');
};
ControllerTest.prototype.start2 = function (ctx) {
ctx.reply('Hello start2');
};
ControllerTest.prototype.command1 = function (ctx) {
ctx.reply('Hello command1');
};
ControllerTest.prototype.hears = function (ctx) {
ctx.reply('Hello hears');
};
ControllerTest.prototype.hearsRegex = function (ctx) {
ctx.reply('Hello hears regex');
};
ControllerTest.prototype.sticker = function (ctx) {
ctx.reply('WOOOW');
};
ControllerTest.prototype.help1 = function (ctx) {
ctx.reply('Hello help1');
};
ControllerTest.prototype.help2 = function (ctx) {
ctx.reply('Hello help2');
};
ControllerTest.prototype.enterGame = function (ctx) {
ctx.scene.enter('game');
};
ControllerTest.prototype.testContainer = function (ctx, msg, chat, telegram) {

@@ -93,5 +65,2 @@ return __awaiter(this, void 0, void 0, function () {

case 0:
console.log(msg.text);
console.log(chat.id);
console.log(telegram);
_b = (_a = ctx).reply;

@@ -107,56 +76,2 @@ return [4 /*yield*/, this.service.getBotName()];

__decorate([
src_1.Start(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], ControllerTest.prototype, "start1", null);
__decorate([
src_1.Start(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], ControllerTest.prototype, "start2", null);
__decorate([
src_1.Command('command1'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], ControllerTest.prototype, "command1", null);
__decorate([
src_1.Hears('hears'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], ControllerTest.prototype, "hears", null);
__decorate([
src_1.Hears(/!.*/),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], ControllerTest.prototype, "hearsRegex", null);
__decorate([
src_1.On('sticker'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], ControllerTest.prototype, "sticker", null);
__decorate([
src_1.Help(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], ControllerTest.prototype, "help1", null);
__decorate([
src_1.Help(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], ControllerTest.prototype, "help2", null);
__decorate([
src_1.Command('entergame'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], ControllerTest.prototype, "enterGame", null);
__decorate([
typedi_1.Inject(),

@@ -163,0 +78,0 @@ __metadata("design:type", TestService_1.TestService)

@@ -23,4 +23,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -27,0 +27,0 @@ case 0: case 1: t = op; break;

@@ -5,13 +5,4 @@ import { TestService } from "../services/TestService";

export declare class ControllerTest {
start1(ctx: any): void;
start2(ctx: any): void;
command1(ctx: any): void;
hears(ctx: any): void;
hearsRegex(ctx: any): void;
sticker(ctx: any): void;
help1(ctx: any): void;
help2(ctx: any): void;
enterGame(ctx: any): void;
service: TestService;
testContainer(ctx: ContextMessageUpdate, msg: IncomingMessage, chat: Chat, telegram: Telegram): Promise<void>;
}
{
"name": "ts-telegraf-decorators",
"version": "0.0.8",
"version": "0.1.0",
"author": "Ivan Surkov <panarama360@gmail.com>",

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

@@ -6,10 +6,10 @@ import 'reflect-metadata'

buildBot({
token: '399545821:AAFpnISF29hakXMgBaP37at-ZuS8JEkyp9o',
const bot = buildBot({
token: '<TOKEN>',
container: Container,
// bot: bot bot instance
// session: session() custom session
controllers: [__dirname+'/controllers/**.js'],
controllers: [__dirname+'/controllers/**.ts'],
// or controllers: [ControllerTest],
}).startPolling()

@@ -16,53 +16,6 @@ import {

//Controller Example
@TFController()
export class ControllerTest {
@Start()
start1(ctx){
ctx.reply('Hello start1')
}
@Start()
start2(ctx){
ctx.reply('Hello start2')
}
@Command('command1')
command1(ctx){
ctx.reply('Hello command1')
}
@Hears('hears')
hears(ctx){
ctx.reply('Hello hears')
}
@Hears(/!.*/)
hearsRegex(ctx){
ctx.reply('Hello hears regex')
}
@On('sticker')
sticker(ctx){
ctx.reply('WOOOW')
}
@Help()
help1(ctx){
ctx.reply('Hello help1')
}
@Help()
help2(ctx){
ctx.reply('Hello help2')
}
@Command('entergame')
enterGame(ctx){
ctx.scene.enter('game')
}
@Inject()

@@ -73,5 +26,2 @@ service: TestService

async testContainer(@TFContext()ctx: ContextMessageUpdate, @TFMessage()msg:IncomingMessage, @TFChat()chat: Chat, @TFTelegram() telegram: Telegram){
console.log(msg.text)
console.log(chat.id)
console.log(telegram)
ctx.reply(await this.service.getBotName())

@@ -78,0 +28,0 @@ }

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