first commit
commit
82f5398007
@ -0,0 +1,34 @@
|
|||||||
|
# dependencies (bun install)
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# output
|
||||||
|
out
|
||||||
|
dist
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# code coverage
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# logs
|
||||||
|
logs
|
||||||
|
_.log
|
||||||
|
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
||||||
|
|
||||||
|
# dotenv environment variable files
|
||||||
|
.env
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.eslintcache
|
||||||
|
.cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# IntelliJ based IDEs
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# Finder (MacOS) folder config
|
||||||
|
.DS_Store
|
@ -0,0 +1,15 @@
|
|||||||
|
# whattask
|
||||||
|
|
||||||
|
To install dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bun install
|
||||||
|
```
|
||||||
|
|
||||||
|
To run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bun run index.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
This project was created using `bun init` in bun v1.2.5. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,190 @@
|
|||||||
|
{
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"workspaces": {
|
||||||
|
"": {
|
||||||
|
"name": "whattask",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.8.4",
|
||||||
|
"dotenv": "^16.4.7",
|
||||||
|
"express": "^4.21.2",
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/bun": "latest",
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": "^5",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@types/bun": ["@types/bun@1.2.5", "", { "dependencies": { "bun-types": "1.2.5" } }, "sha512-w2OZTzrZTVtbnJew1pdFmgV99H0/L+Pvw+z1P67HaR18MHOzYnTYOi6qzErhK8HyT+DB782ADVPPE92Xu2/Opg=="],
|
||||||
|
|
||||||
|
"@types/node": ["@types/node@22.13.11", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-iEUCUJoU0i3VnrCmgoWCXttklWcvoCIx4jzcP22fioIVSdTmjgoEvmAO/QPw6TcS9k5FrNgn4w7q5lGOd1CT5g=="],
|
||||||
|
|
||||||
|
"@types/ws": ["@types/ws@8.5.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="],
|
||||||
|
|
||||||
|
"accepts": ["accepts@1.3.8", "", { "dependencies": { "mime-types": "~2.1.34", "negotiator": "0.6.3" } }, "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw=="],
|
||||||
|
|
||||||
|
"array-flatten": ["array-flatten@1.1.1", "", {}, "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="],
|
||||||
|
|
||||||
|
"asynckit": ["asynckit@0.4.0", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="],
|
||||||
|
|
||||||
|
"axios": ["axios@1.8.4", "", { "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } }, "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw=="],
|
||||||
|
|
||||||
|
"body-parser": ["body-parser@1.20.3", "", { "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" } }, "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g=="],
|
||||||
|
|
||||||
|
"bun-types": ["bun-types@1.2.5", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-3oO6LVGGRRKI4kHINx5PIdIgnLRb7l/SprhzqXapmoYkFl5m4j6EvALvbDVuuBFaamB46Ap6HCUxIXNLCGy+tg=="],
|
||||||
|
|
||||||
|
"bytes": ["bytes@3.1.2", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
|
||||||
|
|
||||||
|
"call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
|
||||||
|
|
||||||
|
"call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="],
|
||||||
|
|
||||||
|
"combined-stream": ["combined-stream@1.0.8", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="],
|
||||||
|
|
||||||
|
"content-disposition": ["content-disposition@0.5.4", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ=="],
|
||||||
|
|
||||||
|
"content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="],
|
||||||
|
|
||||||
|
"cookie": ["cookie@0.7.1", "", {}, "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w=="],
|
||||||
|
|
||||||
|
"cookie-signature": ["cookie-signature@1.0.6", "", {}, "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="],
|
||||||
|
|
||||||
|
"debug": ["debug@2.6.9", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="],
|
||||||
|
|
||||||
|
"delayed-stream": ["delayed-stream@1.0.0", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="],
|
||||||
|
|
||||||
|
"depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="],
|
||||||
|
|
||||||
|
"destroy": ["destroy@1.2.0", "", {}, "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="],
|
||||||
|
|
||||||
|
"dotenv": ["dotenv@16.4.7", "", {}, "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ=="],
|
||||||
|
|
||||||
|
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
|
||||||
|
|
||||||
|
"ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="],
|
||||||
|
|
||||||
|
"encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="],
|
||||||
|
|
||||||
|
"es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
|
||||||
|
|
||||||
|
"es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
|
||||||
|
|
||||||
|
"es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="],
|
||||||
|
|
||||||
|
"es-set-tostringtag": ["es-set-tostringtag@2.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA=="],
|
||||||
|
|
||||||
|
"escape-html": ["escape-html@1.0.3", "", {}, "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="],
|
||||||
|
|
||||||
|
"etag": ["etag@1.8.1", "", {}, "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="],
|
||||||
|
|
||||||
|
"express": ["express@4.21.2", "", { "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", "send": "0.19.0", "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" } }, "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA=="],
|
||||||
|
|
||||||
|
"finalhandler": ["finalhandler@1.3.1", "", { "dependencies": { "debug": "2.6.9", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", "statuses": "2.0.1", "unpipe": "~1.0.0" } }, "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ=="],
|
||||||
|
|
||||||
|
"follow-redirects": ["follow-redirects@1.15.9", "", {}, "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="],
|
||||||
|
|
||||||
|
"form-data": ["form-data@4.0.2", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "mime-types": "^2.1.12" } }, "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w=="],
|
||||||
|
|
||||||
|
"forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="],
|
||||||
|
|
||||||
|
"fresh": ["fresh@0.5.2", "", {}, "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="],
|
||||||
|
|
||||||
|
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
|
||||||
|
|
||||||
|
"get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
|
||||||
|
|
||||||
|
"get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
|
||||||
|
|
||||||
|
"gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
|
||||||
|
|
||||||
|
"has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
|
||||||
|
|
||||||
|
"has-tostringtag": ["has-tostringtag@1.0.2", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="],
|
||||||
|
|
||||||
|
"hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
|
||||||
|
|
||||||
|
"http-errors": ["http-errors@2.0.0", "", { "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": "2.0.1", "toidentifier": "1.0.1" } }, "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ=="],
|
||||||
|
|
||||||
|
"iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA=="],
|
||||||
|
|
||||||
|
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
||||||
|
|
||||||
|
"ipaddr.js": ["ipaddr.js@1.9.1", "", {}, "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="],
|
||||||
|
|
||||||
|
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
|
||||||
|
|
||||||
|
"media-typer": ["media-typer@0.3.0", "", {}, "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ=="],
|
||||||
|
|
||||||
|
"merge-descriptors": ["merge-descriptors@1.0.3", "", {}, "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ=="],
|
||||||
|
|
||||||
|
"methods": ["methods@1.1.2", "", {}, "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w=="],
|
||||||
|
|
||||||
|
"mime": ["mime@1.6.0", "", { "bin": { "mime": "cli.js" } }, "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="],
|
||||||
|
|
||||||
|
"mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="],
|
||||||
|
|
||||||
|
"mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="],
|
||||||
|
|
||||||
|
"ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
|
||||||
|
|
||||||
|
"negotiator": ["negotiator@0.6.3", "", {}, "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="],
|
||||||
|
|
||||||
|
"object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="],
|
||||||
|
|
||||||
|
"on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="],
|
||||||
|
|
||||||
|
"parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="],
|
||||||
|
|
||||||
|
"path-to-regexp": ["path-to-regexp@0.1.12", "", {}, "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ=="],
|
||||||
|
|
||||||
|
"proxy-addr": ["proxy-addr@2.0.7", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg=="],
|
||||||
|
|
||||||
|
"proxy-from-env": ["proxy-from-env@1.1.0", "", {}, "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="],
|
||||||
|
|
||||||
|
"qs": ["qs@6.13.0", "", { "dependencies": { "side-channel": "^1.0.6" } }, "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg=="],
|
||||||
|
|
||||||
|
"range-parser": ["range-parser@1.2.1", "", {}, "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="],
|
||||||
|
|
||||||
|
"raw-body": ["raw-body@2.5.2", "", { "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "unpipe": "1.0.0" } }, "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA=="],
|
||||||
|
|
||||||
|
"safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
|
||||||
|
|
||||||
|
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
|
||||||
|
|
||||||
|
"send": ["send@0.19.0", "", { "dependencies": { "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", "http-errors": "2.0.0", "mime": "1.6.0", "ms": "2.1.3", "on-finished": "2.4.1", "range-parser": "~1.2.1", "statuses": "2.0.1" } }, "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw=="],
|
||||||
|
|
||||||
|
"serve-static": ["serve-static@1.16.2", "", { "dependencies": { "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", "send": "0.19.0" } }, "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw=="],
|
||||||
|
|
||||||
|
"setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
|
||||||
|
|
||||||
|
"side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="],
|
||||||
|
|
||||||
|
"side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="],
|
||||||
|
|
||||||
|
"side-channel-map": ["side-channel-map@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" } }, "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA=="],
|
||||||
|
|
||||||
|
"side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="],
|
||||||
|
|
||||||
|
"statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="],
|
||||||
|
|
||||||
|
"toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="],
|
||||||
|
|
||||||
|
"type-is": ["type-is@1.6.18", "", { "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" } }, "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g=="],
|
||||||
|
|
||||||
|
"typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],
|
||||||
|
|
||||||
|
"undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
|
||||||
|
|
||||||
|
"unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="],
|
||||||
|
|
||||||
|
"utils-merge": ["utils-merge@1.0.1", "", {}, "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA=="],
|
||||||
|
|
||||||
|
"vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
|
||||||
|
|
||||||
|
"send/encodeurl": ["encodeurl@1.0.2", "", {}, "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w=="],
|
||||||
|
|
||||||
|
"send/ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,260 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import axios from 'axios';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
|
||||||
|
// Load environment variables
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const API_URL = process.env.API_URL;
|
||||||
|
const INSTANCE_NAME = process.env.INSTANCE_NAME;
|
||||||
|
const API_KEY = process.env.API_KEY;
|
||||||
|
const WEBHOOK_URL = process.env.WEBHOOK_URL;
|
||||||
|
const COMMUNITY_ID = process.env.COMMUNITY_ID;
|
||||||
|
|
||||||
|
if (!API_URL || !INSTANCE_NAME || !API_KEY || !WEBHOOK_URL || !COMMUNITY_ID) {
|
||||||
|
throw new Error('Required environment variables are not defined.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store community and group information
|
||||||
|
const linkedGroups: Set<string> = new Set();
|
||||||
|
|
||||||
|
// Create an Express app
|
||||||
|
const app = express();
|
||||||
|
app.use(express.json());
|
||||||
|
|
||||||
|
// Fetch all groups and identify the community and linked groups
|
||||||
|
async function fetchGroups() {
|
||||||
|
try {
|
||||||
|
const response = await axios.get(`${API_URL}/group/fetchAllGroups/${INSTANCE_NAME}?getParticipants=false`, {
|
||||||
|
headers: {
|
||||||
|
apikey: API_KEY,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('API Response:', response.data); // Log the full response
|
||||||
|
|
||||||
|
// Check if the response is an array of groups
|
||||||
|
if (Array.isArray(response.data)) {
|
||||||
|
for (const group of response.data) {
|
||||||
|
if (group.id === COMMUNITY_ID) {
|
||||||
|
// This is the community
|
||||||
|
console.log(`Community ID: ${COMMUNITY_ID}`);
|
||||||
|
} else if (group.linkedParent === COMMUNITY_ID) {
|
||||||
|
// This is a group linked to the community
|
||||||
|
linkedGroups.add(group.id);
|
||||||
|
console.log(`Linked Group ID: ${group.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error('Unexpected response format:', response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching groups:', error.response ? error.response.data : error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the bot to a new group
|
||||||
|
async function addBotToGroup(groupId: string) {
|
||||||
|
try {
|
||||||
|
await axios.post(`${API_URL}/group/invite`, {
|
||||||
|
groupId,
|
||||||
|
participants: ['your-bot-phone-number'], // Replace with your bot's phone number
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
apikey: API_KEY,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(`Bot added to group: ${groupId}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error adding bot to group:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Webhook endpoint
|
||||||
|
|
||||||
|
app.post('/webhook', (req, res) => {
|
||||||
|
const event = req.body;
|
||||||
|
console.log('Received event:', JSON.stringify(event, null, 2)); // Log the full event
|
||||||
|
|
||||||
|
// Handle the event
|
||||||
|
if (event.event === 'messages.upsert') {
|
||||||
|
const messageData = event.data;
|
||||||
|
|
||||||
|
// Ignore messages sent by the bot itself
|
||||||
|
// if (messageData.key.fromMe) {
|
||||||
|
// console.log('Ignoring message sent by the bot itself');
|
||||||
|
// return res.status(200).send('OK');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Handle the message
|
||||||
|
handleMessage(messageData);
|
||||||
|
} else if (event.event === 'group_create' && event.data.parentGroupId === COMMUNITY_ID) {
|
||||||
|
// A new group was created in the community
|
||||||
|
const groupId = event.data.groupId;
|
||||||
|
linkedGroups.add(groupId);
|
||||||
|
addBotToGroup(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(200).send('OK');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle incoming messages
|
||||||
|
function handleMessage(messageData: any) {
|
||||||
|
// console.log('Incoming message data:', JSON.stringify(messageData, null, 2)); // Log the full message data
|
||||||
|
|
||||||
|
const body = messageData.message?.conversation;
|
||||||
|
const sender = messageData.key.remoteJid;
|
||||||
|
const groupId = messageData.key.remoteJid; // Group ID for community messages
|
||||||
|
|
||||||
|
// Check if the message is from a group linked to the community
|
||||||
|
if (groupId && linkedGroups.has(groupId) && body) {
|
||||||
|
// Parse the command
|
||||||
|
if (body.startsWith('/tarea')) {
|
||||||
|
// Remove the "/tarea" prefix and trim any extra spaces
|
||||||
|
const command = body.replace('/tarea', '').trim();
|
||||||
|
|
||||||
|
// Split the remaining command into action and arguments
|
||||||
|
const [action, ...args] = command.split(' ');
|
||||||
|
console.log('Parsed action:', action); // Log the action
|
||||||
|
console.log('Parsed args:', args); // Log the arguments
|
||||||
|
|
||||||
|
const description = args.join(' ');
|
||||||
|
console.log('Description:', description); // Log the description
|
||||||
|
|
||||||
|
// Extract assigned user (if any)
|
||||||
|
const assignedUserMatch = description.match(/@\w+/);
|
||||||
|
const assignedUser = assignedUserMatch ? assignedUserMatch[0] : null;
|
||||||
|
|
||||||
|
// Extract due date (if any)
|
||||||
|
const dueDateMatch = description.match(/\d{4}-\d{2}-\d{2}/);
|
||||||
|
const dueDate = dueDateMatch ? dueDateMatch[0] : null;
|
||||||
|
|
||||||
|
// Remove the assigned user and due date from the description
|
||||||
|
const cleanDescription = description
|
||||||
|
.replace(/@\w+/g, '') // Remove assigned user
|
||||||
|
.replace(/\d{4}-\d{2}-\d{2}/g, '') // Remove due date
|
||||||
|
.trim(); // Remove extra spaces
|
||||||
|
|
||||||
|
if (action === 'nueva') {
|
||||||
|
// If no user is assigned, default to the sender
|
||||||
|
const finalAssignedUser = assignedUser || `@${sender.split('@')[0]}`;
|
||||||
|
createTask(sender, cleanDescription, finalAssignedUser, dueDate);
|
||||||
|
} else if (action === 'asignar') {
|
||||||
|
const taskId = args[0];
|
||||||
|
if (assignedUser) {
|
||||||
|
assignTask(sender, taskId, assignedUser);
|
||||||
|
} else {
|
||||||
|
sendMessage(sender, 'Debes mencionar a un usuario para asignar la tarea. Ejemplo: /tarea asignar 1 @usuario');
|
||||||
|
}
|
||||||
|
} else if (action === 'completar') {
|
||||||
|
const taskId = args[0];
|
||||||
|
completeTask(sender, taskId);
|
||||||
|
} else {
|
||||||
|
sendMessage(sender, 'Acción no reconocida. Usa /tarea nueva, /tarea asignar, o /tarea completar.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Create a new task
|
||||||
|
function createTask(sender: string, description: string, assignedUser?: string, dueDate?: string) {
|
||||||
|
const task = {
|
||||||
|
id: tasks.length + 1,
|
||||||
|
description,
|
||||||
|
assignedTo: assignedUser || null,
|
||||||
|
dueDate: dueDate || null,
|
||||||
|
completed: false,
|
||||||
|
};
|
||||||
|
tasks.push(task);
|
||||||
|
sendMessage(sender, `Tarea creada: ${task.id} - ${task.description}${assignedUser ? ` asignada a ${assignedUser}` : ''}${dueDate ? ` para el ${dueDate}` : ''}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign a task
|
||||||
|
function assignTask(sender: string, taskId: string, assignedUser: string) {
|
||||||
|
const task = tasks.find((t) => t.id === parseInt(taskId));
|
||||||
|
if (task) {
|
||||||
|
task.assignedTo = assignedUser;
|
||||||
|
sendMessage(sender, `Tarea ${taskId} asignada a ${assignedUser}`);
|
||||||
|
} else {
|
||||||
|
sendMessage(sender, `Tarea ${taskId} no encontrada`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mark a task as completed
|
||||||
|
function completeTask(sender: string, taskId: string) {
|
||||||
|
const task = tasks.find((t) => t.id === parseInt(taskId));
|
||||||
|
if (task) {
|
||||||
|
task.completed = true;
|
||||||
|
sendMessage(sender, `Tarea ${taskId} marcada como completada`);
|
||||||
|
} else {
|
||||||
|
sendMessage(sender, `Tarea ${taskId} no encontrada`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send a message
|
||||||
|
async function sendMessage(phone: string, message: string) {
|
||||||
|
try {
|
||||||
|
await axios.post(`${API_URL}/message/sendText/${INSTANCE_NAME}`, {
|
||||||
|
number: phone,
|
||||||
|
text: message,
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
apikey: API_KEY,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error sending message:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// In-memory task storage
|
||||||
|
const tasks: any[] = [];
|
||||||
|
|
||||||
|
// Start the webhook server
|
||||||
|
const PORT = 3000;
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Webhook server running on port ${PORT}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Configure the webhook in Evolution API
|
||||||
|
async function configureWebhook() {
|
||||||
|
try {
|
||||||
|
const response = await axios.post(
|
||||||
|
`${API_URL}/webhook/set/${INSTANCE_NAME}`,
|
||||||
|
{
|
||||||
|
webhook: {
|
||||||
|
url: WEBHOOK_URL, // Use the environment variable
|
||||||
|
enabled: true,
|
||||||
|
webhook_by_events: true,
|
||||||
|
webhook_base64: true,
|
||||||
|
events: [
|
||||||
|
'MESSAGES_UPSERT', // New or updated messages
|
||||||
|
'GROUPS_UPSERT', // New or updated groups
|
||||||
|
'GROUP_PARTICIPANTS_UPDATE', // Group participant changes
|
||||||
|
'GROUP_UPDATE', // Group metadata changes (optional)
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
apikey: API_KEY,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
console.log('Webhook configured successfully:', response.data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error configuring webhook:', error.response ? error.response.data : error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch groups and configure the webhook when the bot starts
|
||||||
|
async function startBot() {
|
||||||
|
await fetchGroups();
|
||||||
|
await configureWebhook();
|
||||||
|
}
|
||||||
|
|
||||||
|
startBot();
|
@ -0,0 +1 @@
|
|||||||
|
NO PILAR LOLA HAZEL MARIANGELA TIRSO PAPI BORJA MAMI PILU CORAZSON ROBERT
|
@ -0,0 +1 @@
|
|||||||
|
<ASDFGHJK,LÑLKJHGFDFGHJKLÑLKJNBHJKLÑKGFGHJKLKJHGPOIUYTRJKJHVBGBBVBBNB N N N N NNMMM M NM MHK,HN,B,BOIIIII
|
@ -0,0 +1,723 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "120363410440346762@g.us",
|
||||||
|
"subject": "Mundo Sano",
|
||||||
|
"subjectOwner": "5491166384988@s.whatsapp.net",
|
||||||
|
"subjectTime": 1740583958,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1740583958,
|
||||||
|
"owner": "5491166384988@s.whatsapp.net",
|
||||||
|
"desc": "*¡Hola! Bienvenidos a la Comunidad Mundo Sano.* Para que este canal funcione de forma efectiva es importante respetar las siguientes normas y recomendaciones:\n-\tEnviar *solo información relevante* para el canal\n-\tMinimizar las respuestas a las novedades compartidas: en su lugar optemos por *reaccionar a los mensajes con el emoji* que prefiramos: 👏🏼❤️🥳💪🏼, etc, para evitar un exceso de mensajes. \n-\t *Ser cordiales y respetuosos* en los intercambios.",
|
||||||
|
"descId": "326330AF07D3EFB2CA20201FBE193B03",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": true,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34609275296-1444745013@g.us",
|
||||||
|
"subject": "Zurprais",
|
||||||
|
"subjectOwner": "34609275296@s.whatsapp.net",
|
||||||
|
"subjectTime": 1444745013,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1444745013,
|
||||||
|
"owner": "34609275296@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "5491149790372-1370176464@g.us",
|
||||||
|
"subject": "matanza",
|
||||||
|
"subjectTime": 1370176465,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1370176464,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34605229435-1459326903@g.us",
|
||||||
|
"subject": "Logística #pyaboda",
|
||||||
|
"subjectOwner": "34605229435@s.whatsapp.net",
|
||||||
|
"subjectTime": 1459328160,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57710476_281683476050818_3210963476574896128_n.jpg?ccb=11-4&oh=01_Q5AaIVQhTu_dH_U87RFpng76ldFsOacV2LalXt4Zw5J921Sv&oe=67EC1EDD&_nc_sid=5e03e0&_nc_cat=111",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1459326903,
|
||||||
|
"owner": "34605229435@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34655319666-1434659769@g.us",
|
||||||
|
"subject": "Fiestaca 30!! COTI&JAI",
|
||||||
|
"subjectOwner": "34655319666@s.whatsapp.net",
|
||||||
|
"subjectTime": 1434659769,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57499582_575126586307530_7465263857552850944_n.jpg?ccb=11-4&oh=01_Q5AaIefwCdAus3fgPz43QpMeGayU2Dfr93ROg8D1eiXcSHpz&oe=67EC45DB&_nc_sid=5e03e0&_nc_cat=102",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1434659769,
|
||||||
|
"owner": "34655319666@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34669083546-1344187321@g.us",
|
||||||
|
"subject": "DOMINGO ASCO",
|
||||||
|
"subjectOwner": "34669083546@s.whatsapp.net",
|
||||||
|
"subjectTime": 1344187321,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1344187321,
|
||||||
|
"owner": "34669083546@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861804-1435866873@g.us",
|
||||||
|
"subject": "Disfraz ganador",
|
||||||
|
"subjectOwner": "34650861804@s.whatsapp.net",
|
||||||
|
"subjectTime": 1435866873,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57257130_811364042566833_452084181652996096_n.jpg?ccb=11-4&oh=01_Q5AaIVjGBZWRUQX3-oqOvXiN1SvqwcfprV0eVSNPhYPoWSjm&oe=67EC2D1C&_nc_sid=5e03e0&_nc_cat=107",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1435866873,
|
||||||
|
"owner": "34650861804@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34658918198-1315740928@g.us",
|
||||||
|
"subject": "penacho.",
|
||||||
|
"subjectOwner": "34658918198@s.whatsapp.net",
|
||||||
|
"subjectTime": 1315740928,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1315740928,
|
||||||
|
"owner": "34658918198@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34669083546-1343068401@g.us",
|
||||||
|
"subject": "Coke",
|
||||||
|
"subjectOwner": "34669083546@s.whatsapp.net",
|
||||||
|
"subjectTime": 1343068401,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1343068401,
|
||||||
|
"owner": "34669083546@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861805-1359070526@g.us",
|
||||||
|
"subject": "ya estoy en argentina ",
|
||||||
|
"subjectOwner": "34650861805@s.whatsapp.net",
|
||||||
|
"subjectTime": 1359070526,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1359070526,
|
||||||
|
"owner": "34650861805@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34669083546-1380482624@g.us",
|
||||||
|
"subject": "V. P.",
|
||||||
|
"subjectOwner": "34669083546@s.whatsapp.net",
|
||||||
|
"subjectTime": 1380482624,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1380482624,
|
||||||
|
"owner": "34669083546@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34669083546-1341787993@g.us",
|
||||||
|
"subject": "FIN",
|
||||||
|
"subjectOwner": "34669083546@s.whatsapp.net",
|
||||||
|
"subjectTime": 1341787993,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57370851_358176508132751_2668941417023275008_n.jpg?ccb=11-4&oh=01_Q5AaIft8oIcs8u38u1hqWhhqGKicjCGEBBMxLTfLcJoVvAwp&oe=67EC4B53&_nc_sid=5e03e0&_nc_cat=106",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1341787993,
|
||||||
|
"owner": "34669083546@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861805-1347733220@g.us",
|
||||||
|
"subject": "partis hoy",
|
||||||
|
"subjectOwner": "34650861805@s.whatsapp.net",
|
||||||
|
"subjectTime": 1347733220,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1347733220,
|
||||||
|
"owner": "34650861805@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34675153089-1426270474@g.us",
|
||||||
|
"subject": "Domingo?",
|
||||||
|
"subjectOwner": "34675153089@s.whatsapp.net",
|
||||||
|
"subjectTime": 1426270474,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1426270474,
|
||||||
|
"owner": "34675153089@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34627368368-1354874666@g.us",
|
||||||
|
"subject": "Hoy",
|
||||||
|
"subjectTime": 1354874666,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1354874666,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34658918198-1370549247@g.us",
|
||||||
|
"subject": "Parapedal",
|
||||||
|
"subjectOwner": "34658918198@s.whatsapp.net",
|
||||||
|
"subjectTime": 1370596206,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1370549247,
|
||||||
|
"owner": "34658918198@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34657450960-1336132958@g.us",
|
||||||
|
"subject": "open tenis",
|
||||||
|
"subjectTime": 1336132958,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57620852_326372454958768_5685663150800633856_n.jpg?ccb=11-4&oh=01_Q5AaIcDiCte11vEWALwonGeFJppN8gsdBLoFQz8Qn3JlkeGF&oe=67EC1604&_nc_sid=5e03e0&_nc_cat=109",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1336132958,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861805-1370257483@g.us",
|
||||||
|
"subject": "Oooooh ",
|
||||||
|
"subjectOwner": "34650861805@s.whatsapp.net",
|
||||||
|
"subjectTime": 1370257483,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57166223_2377053395861776_3778793762679947264_n.jpg?ccb=11-4&oh=01_Q5AaIRI_UPI2cKdu6b_MHEJWh7eLdwIy1SiBjGjDMUGpcnEY&oe=67EC44E8&_nc_sid=5e03e0&_nc_cat=111",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1370257483,
|
||||||
|
"owner": "34650861805@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34669083546-1339086629@g.us",
|
||||||
|
"subject": "GRAD\"UAX\"CIÓN",
|
||||||
|
"subjectOwner": "34669083546@s.whatsapp.net",
|
||||||
|
"subjectTime": 1339086629,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1339086629,
|
||||||
|
"owner": "34669083546@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34690291616-1455457436@g.us",
|
||||||
|
"subject": "PLANACOS 2016",
|
||||||
|
"subjectTime": 1455457436,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1455457436,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34676194946-1372348029@g.us",
|
||||||
|
"subject": "Cumple Coti",
|
||||||
|
"subjectOwner": "34676194946@s.whatsapp.net",
|
||||||
|
"subjectTime": 1372348029,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1372348029,
|
||||||
|
"owner": "34676194946@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "447478545442-1445455272@g.us",
|
||||||
|
"subject": "Pedri",
|
||||||
|
"subjectTime": 1445455272,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1445455272,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "5491149790372-1370176156@g.us",
|
||||||
|
"subject": "matanza",
|
||||||
|
"subjectTime": 1370176156,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1370176156,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34658918198-1364156413@g.us",
|
||||||
|
"subject": "pedriceros ",
|
||||||
|
"subjectTime": 1370432938,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57328048_289097135355720_8231965393049092096_n.jpg?ccb=11-4&oh=01_Q5AaIW2hoF2roAle8UeiBSmLesk7aUl-1a5hbPO2Ng654LL-&oe=67EC179C&_nc_sid=5e03e0&_nc_cat=106",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1364156413,
|
||||||
|
"owner": "34658918198@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34676194946-1368393564@g.us",
|
||||||
|
"subject": "cumple coti jerte",
|
||||||
|
"subjectOwner": "34676194946@s.whatsapp.net",
|
||||||
|
"subjectTime": 1368393564,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/56649576_2641939215881186_6707991106711191552_n.jpg?ccb=11-4&oh=01_Q5AaIQuanRMPG20ReFjCugBx50aZorIl7_6fEbphSuJ6Ikxv&oe=67EC227A&_nc_sid=5e03e0&_nc_cat=105",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1368393564,
|
||||||
|
"owner": "34676194946@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861805-1324066953@g.us",
|
||||||
|
"subject": "yago",
|
||||||
|
"subjectOwner": "34650861805@s.whatsapp.net",
|
||||||
|
"subjectTime": 1324066953,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1324066953,
|
||||||
|
"owner": "34650861805@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "447508988138-1378159483@g.us",
|
||||||
|
"subject": "AsiP.A.G.!",
|
||||||
|
"subjectOwner": "447508988138@s.whatsapp.net",
|
||||||
|
"subjectTime": 1378159483,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/56381662_2180370658722860_8510505378088222720_n.jpg?ccb=11-4&oh=01_Q5AaIbuqHf_FjfjJ_pHW3vrpzhNMniYVriVhp3MZdOFXnGR9&oe=67EC305D&_nc_sid=5e03e0&_nc_cat=100",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1378159483,
|
||||||
|
"owner": "447508988138@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34690291616-1347371144@g.us",
|
||||||
|
"subject": "MEN IN BLACK III",
|
||||||
|
"subjectTime": 1347371144,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1347371144,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "447508988138-1389210957@g.us",
|
||||||
|
"subject": "Despedida!",
|
||||||
|
"subjectOwner": "447508988138@s.whatsapp.net",
|
||||||
|
"subjectTime": 1389210957,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57556982_280885742823708_4571544309186166784_n.jpg?ccb=11-4&oh=01_Q5AaIUk5N0pP4AWLebLODyBDP9_iPWOCmvFDirWz96-D44gR&oe=67EC3FEF&_nc_sid=5e03e0&_nc_cat=111",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1389210957,
|
||||||
|
"owner": "447508988138@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34690291616-1428260464@g.us",
|
||||||
|
"subject": "SE HACE VIEJO",
|
||||||
|
"subjectTime": 1428260464,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/56328747_443895066361223_3739540123826520064_n.jpg?ccb=11-4&oh=01_Q5AaIWfUiRL_4elA9cympkMQP2MDoAJT4-teHJAVUwqW_bvw&oe=67EC2795&_nc_sid=5e03e0&_nc_cat=106",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1428260464,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861805-1352565357@g.us",
|
||||||
|
"subject": "pura vida ",
|
||||||
|
"subjectOwner": "34650861805@s.whatsapp.net",
|
||||||
|
"subjectTime": 1352565357,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1352565357,
|
||||||
|
"owner": "34650861805@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34658918198-1388053869@g.us",
|
||||||
|
"subject": "gredos. ",
|
||||||
|
"subjectOwner": "34658918198@s.whatsapp.net",
|
||||||
|
"subjectTime": 1388053869,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1388053869,
|
||||||
|
"owner": "34658918198@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34609275296-1353764698@g.us",
|
||||||
|
"subject": "Comida",
|
||||||
|
"subjectOwner": "34609275296@s.whatsapp.net",
|
||||||
|
"subjectTime": 1353764698,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1353764698,
|
||||||
|
"owner": "34609275296@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34658918198-1372351810@g.us",
|
||||||
|
"subject": "jerte pa ca!",
|
||||||
|
"subjectOwner": "34658918198@s.whatsapp.net",
|
||||||
|
"subjectTime": 1372351810,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1372351810,
|
||||||
|
"owner": "34658918198@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34609275296-1343397397@g.us",
|
||||||
|
"subject": "Llegada",
|
||||||
|
"subjectOwner": "34609275296@s.whatsapp.net",
|
||||||
|
"subjectTime": 1343397397,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1343397397,
|
||||||
|
"owner": "34609275296@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861805-1362512839@g.us",
|
||||||
|
"subject": "Revista aniversario ",
|
||||||
|
"subjectOwner": "34650861805@s.whatsapp.net",
|
||||||
|
"subjectTime": 1362512839,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1362512839,
|
||||||
|
"owner": "34650861805@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34620336548-1355932247@g.us",
|
||||||
|
"subject": "Hobbit",
|
||||||
|
"subjectTime": 1355932247,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1355932247,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34618900653-1383776799@g.us",
|
||||||
|
"subject": "Sábado sabadete",
|
||||||
|
"subjectOwner": "34618900653@s.whatsapp.net",
|
||||||
|
"subjectTime": 1383776858,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57217970_285468459051945_1621936284131917824_n.jpg?ccb=11-4&oh=01_Q5AaIYjc_sBzJiAHWSTthV9dKRP00M9TzISnfgtizXmA5ePF&oe=67EC1B5C&_nc_sid=5e03e0&_nc_cat=103",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1383776799,
|
||||||
|
"owner": "34618900653@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34609275296-1445689975@g.us",
|
||||||
|
"subject": "Fíestuki",
|
||||||
|
"subjectOwner": "34609275296@s.whatsapp.net",
|
||||||
|
"subjectTime": 1445689975,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1445689975,
|
||||||
|
"owner": "34609275296@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34609275296-1445351386@g.us",
|
||||||
|
"subject": "Zurpais",
|
||||||
|
"subjectOwner": "34609275296@s.whatsapp.net",
|
||||||
|
"subjectTime": 1445351386,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1445351386,
|
||||||
|
"owner": "34609275296@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861805-1392064457@g.us",
|
||||||
|
"subject": "bill callahan ",
|
||||||
|
"subjectOwner": "34650861805@s.whatsapp.net",
|
||||||
|
"subjectTime": 1392064458,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1392064457,
|
||||||
|
"owner": "34650861805@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34676194946-1405091498@g.us",
|
||||||
|
"subject": "Baghete se va",
|
||||||
|
"subjectOwner": "34676194946@s.whatsapp.net",
|
||||||
|
"subjectTime": 1405091615,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/56660114_393201181235438_4403947778988834816_n.jpg?ccb=11-4&oh=01_Q5AaIRN0ATWgRo8R1gpwHsvw3bUASxszh9V2Exw4hHpnMmPF&oe=67EC152B&_nc_sid=5e03e0&_nc_cat=106",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1405091498,
|
||||||
|
"owner": "34676194946@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34658918198-1364245989@g.us",
|
||||||
|
"subject": "rezagados",
|
||||||
|
"subjectOwner": "34658918198@s.whatsapp.net",
|
||||||
|
"subjectTime": 1364245989,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1364245989,
|
||||||
|
"owner": "34658918198@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34670475786-1389702816@g.us",
|
||||||
|
"subject": "Cocido montés",
|
||||||
|
"subjectOwner": "34670475786@s.whatsapp.net",
|
||||||
|
"subjectTime": 1389702816,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57004973_2607698942577631_3100422309844877312_n.jpg?ccb=11-4&oh=01_Q5AaIShPx-Snq17ApATOBEk-DVBnZ5f7v-1DY2zwQI3evRTS&oe=67EC1EE9&_nc_sid=5e03e0&_nc_cat=101",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1389702816,
|
||||||
|
"owner": "34670475786@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34629715374-1525166558@g.us",
|
||||||
|
"subject": "18 de mayo",
|
||||||
|
"subjectOwner": "34629715374@s.whatsapp.net",
|
||||||
|
"subjectTime": 1525166558,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1525166558,
|
||||||
|
"owner": "34629715374@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "5491149790372-1355081856@g.us",
|
||||||
|
"subject": "parrilla",
|
||||||
|
"subjectTime": 1355081856,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1355081856,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34609275296-1364218956@g.us",
|
||||||
|
"subject": "Ultimo cuadro",
|
||||||
|
"subjectOwner": "34609275296@s.whatsapp.net",
|
||||||
|
"subjectTime": 1364218956,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1364218956,
|
||||||
|
"owner": "34609275296@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34676194946-1374007125@g.us",
|
||||||
|
"subject": "campavisit",
|
||||||
|
"subjectOwner": "34676194946@s.whatsapp.net",
|
||||||
|
"subjectTime": 1374007125,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57644492_634415980305471_9133741103088926720_n.jpg?ccb=11-4&oh=01_Q5AaIfZb_tLwKYqBsYoUzHrffDOAdafVt1hCixL1OZ-U3ELZ&oe=67EC4637&_nc_sid=5e03e0&_nc_cat=106",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1374007125,
|
||||||
|
"owner": "34676194946@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34670475786-1394482283@g.us",
|
||||||
|
"subject": " Integral Pedriza",
|
||||||
|
"subjectOwner": "34670475786@s.whatsapp.net",
|
||||||
|
"subjectTime": 1394482283,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/57204152_741882499547478_6370406342238142464_n.jpg?ccb=11-4&oh=01_Q5AaISi3rgxUTdSxV-n8uEqInkDqKIwccZJ5FjH6oT7GWcpV&oe=67EC3232&_nc_sid=5e03e0&_nc_cat=109",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1394482283,
|
||||||
|
"owner": "34670475786@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34627368368-1386270308@g.us",
|
||||||
|
"subject": "Segovia",
|
||||||
|
"subjectTime": 1386270308,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1386270308,
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861805-1492937606@g.us",
|
||||||
|
"subject": "Yo",
|
||||||
|
"subjectOwner": "34650861805@s.whatsapp.net",
|
||||||
|
"subjectTime": 1492937606,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1492937606,
|
||||||
|
"owner": "34650861805@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34617192209-1444665797@g.us",
|
||||||
|
"subject": "Despedida soltera",
|
||||||
|
"subjectOwner": "34617192209@s.whatsapp.net",
|
||||||
|
"subjectTime": 1444665797,
|
||||||
|
"pictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/56716451_2217800824945118_9051684077861601280_n.jpg?ccb=11-4&oh=01_Q5AaIS8iT5-fEnsAx2uI61goaUqivsPicADVt2AITJcc36ud&oe=67EC3342&_nc_sid=5e03e0&_nc_cat=108",
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1444665797,
|
||||||
|
"owner": "34617192209@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "34650861804-1351950066@g.us",
|
||||||
|
"subject": "Hoola corazones",
|
||||||
|
"subjectOwner": "34650861804@s.whatsapp.net",
|
||||||
|
"subjectTime": 1351950066,
|
||||||
|
"pictureUrl": null,
|
||||||
|
"size": 1,
|
||||||
|
"creation": 1351950066,
|
||||||
|
"owner": "34650861804@s.whatsapp.net",
|
||||||
|
"restrict": false,
|
||||||
|
"announce": false,
|
||||||
|
"isCommunity": false,
|
||||||
|
"isCommunityAnnounce": false
|
||||||
|
}
|
||||||
|
]
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "whattask",
|
||||||
|
"module": "index.ts",
|
||||||
|
"type": "module",
|
||||||
|
"private": true,
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/bun": "latest"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": "^5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.8.4",
|
||||||
|
"dotenv": "^16.4.7",
|
||||||
|
"express": "^4.21.2"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
import { fetchGroups, configureWebhook, addBotToGroup } from './utils/api';
|
||||||
|
|
||||||
|
// Store community and group information
|
||||||
|
export const linkedGroups: Set<string> = new Set(); // Ensure this is exported
|
||||||
|
|
||||||
|
export async function startBot() {
|
||||||
|
const communityId = process.env.COMMUNITY_ID;
|
||||||
|
const webhookUrl = process.env.WEBHOOK_URL;
|
||||||
|
|
||||||
|
if (!communityId || !webhookUrl) {
|
||||||
|
throw new Error('Required environment variables are not defined.');
|
||||||
|
}
|
||||||
|
|
||||||
|
await fetchGroups(communityId);
|
||||||
|
await configureWebhook(webhookUrl);
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
import { sendMessage } from '../utils/messaging';
|
||||||
|
import { createTask, assignTask, completeTask } from '../../services/taskService';
|
||||||
|
|
||||||
|
export function handleTaskCommand(body: string, sender: string, groupId: string, linkedGroups: Set<string>) {
|
||||||
|
// Check if the message is from a group linked to the community
|
||||||
|
if (groupId && linkedGroups.has(groupId)) { // Fixed: Added missing closing parenthesis
|
||||||
|
// Parse the command
|
||||||
|
if (body.startsWith('/tarea')) {
|
||||||
|
// Remove the "/tarea" prefix and trim any extra spaces
|
||||||
|
const command = body.replace('/tarea', '').trim();
|
||||||
|
|
||||||
|
// Split the remaining command into action and arguments
|
||||||
|
const [action, ...args] = command.split(' ');
|
||||||
|
console.log('Parsed action:', action); // Log the action
|
||||||
|
console.log('Parsed args:', args); // Log the arguments
|
||||||
|
|
||||||
|
const description = args.join(' ');
|
||||||
|
console.log('Description:', description); // Log the description
|
||||||
|
|
||||||
|
// Extract assigned user (if any)
|
||||||
|
const assignedUserMatch = description.match(/@\w+/);
|
||||||
|
const assignedUser = assignedUserMatch ? assignedUserMatch[0] : null;
|
||||||
|
|
||||||
|
// Extract due date (if any)
|
||||||
|
const dueDateMatch = description.match(/\d{4}-\d{2}-\d{2}/);
|
||||||
|
const dueDate = dueDateMatch ? dueDateMatch[0] : null;
|
||||||
|
|
||||||
|
// Remove the assigned user and due date from the description
|
||||||
|
const cleanDescription = description
|
||||||
|
.replace(/@\w+/g, '') // Remove assigned user
|
||||||
|
.replace(/\d{4}-\d{2}-\d{2}/g, '') // Remove due date
|
||||||
|
.trim(); // Remove extra spaces
|
||||||
|
|
||||||
|
if (action === 'nueva') {
|
||||||
|
// If no user is assigned, default to the sender
|
||||||
|
const finalAssignedUser = assignedUser || `@${sender.split('@')[0]}`;
|
||||||
|
createTask(sender, cleanDescription, finalAssignedUser, dueDate);
|
||||||
|
} else if (action === 'asignar') {
|
||||||
|
const taskId = args[0];
|
||||||
|
if (assignedUser) {
|
||||||
|
assignTask(sender, taskId, assignedUser);
|
||||||
|
} else {
|
||||||
|
sendMessage(sender, 'Debes mencionar a un usuario para asignar la tarea. Ejemplo: /tarea asignar 1 @usuario');
|
||||||
|
}
|
||||||
|
} else if (action === 'completar') {
|
||||||
|
const taskId = args[0];
|
||||||
|
completeTask(sender, taskId);
|
||||||
|
} else {
|
||||||
|
sendMessage(sender, 'Acción no reconocida. Usa /tarea nueva, /tarea asignar, o /tarea completar.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const API_URL = process.env.API_URL;
|
||||||
|
const INSTANCE_NAME = process.env.INSTANCE_NAME;
|
||||||
|
const API_KEY = process.env.API_KEY;
|
||||||
|
|
||||||
|
if (!API_URL || !INSTANCE_NAME || !API_KEY) {
|
||||||
|
throw new Error('Required environment variables are not defined.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch all groups and identify the community and linked groups
|
||||||
|
export async function fetchGroups(communityId: string): Promise<Set<string>> {
|
||||||
|
const linkedGroups = new Set<string>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await axios.get(`${API_URL}/group/fetchAllGroups/${INSTANCE_NAME}?getParticipants=false`, {
|
||||||
|
headers: {
|
||||||
|
apikey: API_KEY,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('API Response:', response.data); // Log the full response
|
||||||
|
|
||||||
|
// Check if the response is an array of groups
|
||||||
|
if (Array.isArray(response.data)) {
|
||||||
|
for (const group of response.data) {
|
||||||
|
if (group.id === communityId) {
|
||||||
|
// This is the community
|
||||||
|
console.log(`Community ID: ${communityId}`);
|
||||||
|
} else if (group.linkedParent === communityId) {
|
||||||
|
// This is a group linked to the community
|
||||||
|
linkedGroups.add(group.id);
|
||||||
|
console.log(`Linked Group ID: ${group.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error('Unexpected response format:', response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching groups:', error.response ? error.response.data : error.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return linkedGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the bot to a new group
|
||||||
|
export async function addBotToGroup(groupId: string) {
|
||||||
|
try {
|
||||||
|
await axios.post(`${API_URL}/group/invite`, {
|
||||||
|
groupId,
|
||||||
|
participants: ['your-bot-phone-number'], // Replace with your bot's phone number
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
apikey: API_KEY,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(`Bot added to group: ${groupId}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error adding bot to group:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure the webhook in Evolution API
|
||||||
|
export async function configureWebhook(webhookUrl: string) {
|
||||||
|
try {
|
||||||
|
const response = await axios.post(
|
||||||
|
`${API_URL}/webhook/set/${INSTANCE_NAME}`,
|
||||||
|
{
|
||||||
|
webhook: {
|
||||||
|
url: webhookUrl,
|
||||||
|
enabled: true,
|
||||||
|
webhook_by_events: true,
|
||||||
|
webhook_base64: true,
|
||||||
|
events: [
|
||||||
|
'MESSAGES_UPSERT', // New or updated messages
|
||||||
|
'GROUPS_UPSERT', // New or updated groups
|
||||||
|
'GROUP_PARTICIPANTS_UPDATE', // Group participant changes
|
||||||
|
'GROUP_UPDATE', // Group metadata changes (optional)
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
apikey: API_KEY,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
console.log('Webhook configured successfully:', response.data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error configuring webhook:', error.response ? error.response.data : error.message);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const API_URL = process.env.API_URL;
|
||||||
|
const INSTANCE_NAME = process.env.INSTANCE_NAME;
|
||||||
|
const API_KEY = process.env.API_KEY;
|
||||||
|
|
||||||
|
if (!API_URL || !INSTANCE_NAME || !API_KEY) {
|
||||||
|
throw new Error('Required environment variables are not defined.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send a message
|
||||||
|
export async function sendMessage(phone: string, message: string) {
|
||||||
|
try {
|
||||||
|
await axios.post(`${API_URL}/message/sendText/${INSTANCE_NAME}`, {
|
||||||
|
number: phone,
|
||||||
|
text: message,
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
apikey: API_KEY,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error sending message:', error);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
import dotenv from 'dotenv';
|
||||||
|
import { startBot } from './bot/bot';
|
||||||
|
import { startServer } from './server/server';
|
||||||
|
|
||||||
|
// Load environment variables
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const PORT = 3000;
|
||||||
|
|
||||||
|
// Start the bot and server
|
||||||
|
async function main() {
|
||||||
|
await startBot();
|
||||||
|
startServer(PORT);
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch((error) => {
|
||||||
|
console.error('Error starting the bot:', error);
|
||||||
|
});
|
@ -0,0 +1,7 @@
|
|||||||
|
export interface Task {
|
||||||
|
id: number;
|
||||||
|
description: string;
|
||||||
|
assignedTo: string | null;
|
||||||
|
dueDate: string | null;
|
||||||
|
completed: boolean;
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import { handleTaskCommand } from '../bot/commands/task';
|
||||||
|
import { linkedGroups } from '../bot/bot'; // Ensure the import path is correct
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
app.use(express.json());
|
||||||
|
|
||||||
|
// Webhook endpoint
|
||||||
|
app.post('/webhook', (req, res) => {
|
||||||
|
const event = req.body;
|
||||||
|
console.log('Received event:', JSON.stringify(event, null, 2)); // Log the full event
|
||||||
|
|
||||||
|
// Handle the event
|
||||||
|
if (event.event === 'messages.upsert') {
|
||||||
|
const messageData = event.data;
|
||||||
|
|
||||||
|
// Ignore messages sent by the bot itself
|
||||||
|
if (messageData.key.fromMe) {
|
||||||
|
console.log('Ignoring message sent by the bot itself');
|
||||||
|
return res.status(200).send('OK');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle the message
|
||||||
|
handleTaskCommand(
|
||||||
|
messageData.message?.conversation || '', // Fixed typo: "conversation" instead of "conversation"
|
||||||
|
messageData.key.remoteJid,
|
||||||
|
messageData.key.remoteJid,
|
||||||
|
linkedGroups
|
||||||
|
);
|
||||||
|
} else if (event.event === 'group_create' && event.data.parentGroupId === process.env.COMMUNITY_ID) {
|
||||||
|
// A new group was created in the community
|
||||||
|
const groupId = event.data.groupId;
|
||||||
|
linkedGroups.add(groupId);
|
||||||
|
addBotToGroup(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(200).send('OK');
|
||||||
|
});
|
||||||
|
|
||||||
|
export function startServer(port: number) {
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`Webhook server running on port ${port}`);
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
import { Task } from '../models/task';
|
||||||
|
import { sendMessage } from '../bot/utils/messaging';
|
||||||
|
|
||||||
|
// In-memory task storage
|
||||||
|
let tasks: Task[] = [];
|
||||||
|
|
||||||
|
// Create a new task
|
||||||
|
export function createTask(sender: string, description: string, assignedUser?: string, dueDate?: string) {
|
||||||
|
const task: Task = {
|
||||||
|
id: tasks.length + 1,
|
||||||
|
description,
|
||||||
|
assignedTo: assignedUser || null,
|
||||||
|
dueDate: dueDate || null,
|
||||||
|
completed: false,
|
||||||
|
};
|
||||||
|
tasks.push(task);
|
||||||
|
sendMessage(sender, `Tarea creada: ${task.id} - ${task.description}${assignedUser ? ` asignada a ${assignedUser}` : ''}${dueDate ? ` para el ${dueDate}` : ''}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign a task
|
||||||
|
export function assignTask(sender: string, taskId: string, assignedUser: string) {
|
||||||
|
const task = tasks.find((t) => t.id === parseInt(taskId));
|
||||||
|
if (task) {
|
||||||
|
task.assignedTo = assignedUser;
|
||||||
|
sendMessage(sender, `Tarea ${taskId} asignada a ${assignedUser}`);
|
||||||
|
} else {
|
||||||
|
sendMessage(sender, `Tarea ${taskId} no encontrada`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mark a task as completed
|
||||||
|
export function completeTask(sender: string, taskId: string) {
|
||||||
|
const task = tasks.find((t) => t.id === parseInt(taskId));
|
||||||
|
if (task) {
|
||||||
|
task.completed = true;
|
||||||
|
sendMessage(sender, `Tarea ${taskId} marcada como completada`);
|
||||||
|
} else {
|
||||||
|
sendMessage(sender, `Tarea ${taskId} no encontrada`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all tasks (for debugging or future use)
|
||||||
|
export function getTasks(): Task[] {
|
||||||
|
return tasks;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
// Environment setup & latest features
|
||||||
|
"lib": ["esnext"],
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"allowJs": true,
|
||||||
|
|
||||||
|
// Bundler mode
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
// Best practices
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedIndexedAccess": true,
|
||||||
|
|
||||||
|
// Some stricter flags (disabled by default)
|
||||||
|
"noUnusedLocals": false,
|
||||||
|
"noUnusedParameters": false,
|
||||||
|
"noPropertyAccessFromIndexSignature": false
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue