nestwhats
Version:
A whatsapp-web.js wrapper for NestJS to create WhatsApp bots
21 lines (20 loc) • 1.24 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Chat = void 0;
const common_1 = require("@nestjs/common");
const context_1 = require("../../context");
exports.Chat = (0, common_1.createParamDecorator)((_, context) => __awaiter(void 0, void 0, void 0, function* () {
var _a;
const ctx = context_1.NestWhatsExecutionContext.create(context);
const [message] = ctx.getContext();
return (_a = message === null || message === void 0 ? void 0 : message.getChat()) !== null && _a !== void 0 ? _a : null;
}));