Anonymous Chat Cloudflare Worker Telegram Bot
- First, create a Python Worker in Cloudflare, delete all the existing code, and paste the code you got from the link above.
- Then, go to Storage & Databases and create a new database (the name doesn’t matter).
- Enter the database and open the console.
Copy the code below:
CREATE TABLE users (
"id" integer PRIMARY KEY,
"telegram_user_id" text,
"rkey" text,
"target_user" text
);
- Then, go to the Worker and in the Settings, under Bindings, bind the database you created with the name
db
. - Create a bot on Telegram using @BotFather.
- For BOT_TOKEN, put the token of your bot.
- For BOT_ID, use the bot's ID without the
@
. - Click on Visit.
- The Worker will open in your browser. Add
/init
at the end of the URL, for example:https://yourworker.username.workers.dev/init
and press Enter to set the webhook.