Run Telegram messaging bot on Cloudflare Worker.
- Get your new bot token from @BotFather: https://core.telegram.org/bots#6-botfather
- Sign up to Cloudflare Workers: https://workers.cloudflare.com/
- In the Cloudflare Dashboard go to "Workers" and then click "Create a Service"
- Choose a name and click "Create a Service" to create the worker
- Click on "Quick Edit" to change the source code of your new worker
- Copy and paste the code from bot_en.js into the editor
- Replace the
TOKEN
variable in the code with your token from @BotFather - Replace the
ADMIN
variable in the code with your Chat id from @chatIDrobot - Click on "Save and Deploy"
- In the middle panel append
/registerWebhook
to the url. For example: https://my-worker-123.username.workers.dev/registerWebhook - Click "Send". In the right panel should appear
Ok
. If 401 Unauthorized appears, you may have used a wrong bot token. - Alright, it's done. Now you can use the messaging bot.
ربات پیام رسان تلگرام در Cloudflare Worker اجرا کنید.
1.توکن از ربات @BotFather بگیرید
2.در سایت https://workers.cloudflare.com ثبت نام کنید
3.در داشبورد Cloudflare به "Workers" برید و روی "Create a Service" کلیک کنید
4.یک نام دلخواه وارد کنید و روی "Create a Service" کلیک کنید
5.روی "Quick Edit" کلیک کنید
6.حالا bot_fa.js قسمت های لازم ویرایش کنید و کپی کنید "Quick Edit" قرار بدید
7.روی "Save and Deploy" کلیک کنید
9.به اخر دامنه/registerWebhook
اضافه کنید برای مثال https://my-worker-123.username.workers.dev/registerWebhook
11.روی "Send" کلیک کنید. در پنل سمت راست باید "Ok" ظاهر بشه. اگر 401 Unauthorized ظاهر شد، ممکنه توکن وارد شده اشتباه باشه.
12.خب تموم شد الان میتونید ربات پیام رسان استفاده کنید