V
Size: a a a
V
OO
I
ym
JD
Y💜
J
OO
J
OO
S
var MyClass = class {
constructor(ctx, next) {
this.ctx = ctx;
}
send(text) {
var self = this;
return new Promise(function(res) {
self.ctx.reply(text).then(function(ctx) {
res.call(ctx, ctx);
});
});
}
};
var Telegraf = require('telegraf');
var bot = new Telegraf(process.env.BOT_TOKEN);
// Простой текст
bot.hears('text', function(ctx) {
var my = new MyClass(ctx);
my.send('Простой текст!').then(function() {
console.log(arguments);
console.log(this);
});
});
bot.launch();
Делаю свою обертку над ctx.reply☔
OO
ym
M
ym
E