@codebam/cf-workers-telegram-bot 11.0.0 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/telegram_bot.js +2 -2
- package/package.json +1 -1
package/dist/telegram_bot.js
CHANGED
|
@@ -128,7 +128,7 @@ export default class TelegramBot {
|
|
|
128
128
|
this.webhook = new Webhook(this.token, request);
|
|
129
129
|
const url = new URL(request.url);
|
|
130
130
|
// Check if the request is for this bot
|
|
131
|
-
if (`/${this.token}`
|
|
131
|
+
if (!url.pathname.startsWith(`/${this.token}`)) {
|
|
132
132
|
return new Response('Invalid token', { status: 404 });
|
|
133
133
|
}
|
|
134
134
|
// Handle different HTTP methods
|
|
@@ -157,7 +157,7 @@ export default class TelegramBot {
|
|
|
157
157
|
}
|
|
158
158
|
case 'GET': {
|
|
159
159
|
const command = url.searchParams.get('command');
|
|
160
|
-
if (command === 'set') {
|
|
160
|
+
if (command === 'set' || url.pathname.endsWith('/setWebhook')) {
|
|
161
161
|
return this.webhook.set();
|
|
162
162
|
}
|
|
163
163
|
return new Response('Invalid command', { status: 400 });
|