Skip to content

Commit 6cf67bd

Browse files
committed
"Removed unnecessary script from package.json and added logging for HTTP requests in bot/index.ts, also added bot start callback"
1 parent 2606bca commit 6cf67bd

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"clean": "rm -rf dist",
2121
"main": "npm run build & node --env-file=.env dist/app.js",
2222
"start": "NODE_ENV=development node --trace-uncaught -r ts-node/register --env-file=.env src/app.ts",
23-
"start:deploy": "NODE_ENV=production node --trace-uncaught -r ts-node/register src/app.ts",
24-
"start:deplow:dev": "NODE_ENV=development node --trace-uncaught -r ts-node/register src/app.ts"
23+
"start:deploy": "NODE_ENV=production node --trace-uncaught -r ts-node/register src/app.ts"
2524
},
2625
"repository": {
2726
"type": "git",

src/bot/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export class CopBot {
3232
const isProduction = Config.environment === 'production';
3333
if (isProduction) {
3434
const server = http.createServer(async (req, res) => {
35+
console.log('method',req.method);
36+
console.log('url', req.url);
37+
3538
if (req.method === 'POST' && req.url === '/webhook') {
3639
let body = '';
3740
req.on('data', (chunk) => {
@@ -71,6 +74,11 @@ export class CopBot {
7174
});
7275
await this._bot.api.setWebhook(`${web_hook}`);
7376
console.log(`Webhook set successfully to: ${web_hook}`);
77+
await this._bot.start({
78+
onStart: (botInfo) => {
79+
console.log(`Bot started in Webhook mode! Username: ${botInfo.username}`);
80+
},
81+
});
7482
} else {
7583
try {
7684
await this._bot.start({

0 commit comments

Comments
 (0)