Reaction score
We create a Telegram bot through BotFather. We write /start, then we write /newbot.

We write the name of the bot.


Next, we need to write the username of the bot. We write a username that ends in “bot” or “_bot”


After this we receive the API-Token of the bot, which will be needed a little later


For the script to work you need to get Bing's Cookie​

To receive cookies, you must install an extension that allows you to do this. I used Cookie Editor.

You can use any other one, I won’t advise anything in this regard, I can’t vouch for the Cookie Editor.

After installing the extension, turn on the VPN, go to https://bing.com/, create an Outlook email (for convenience and speed), send a request to the waiting list (Now it seems to work without it, but still) .

After access to the chat with BingAI has been obtained, go to https://bing.com/chat, log into the previously created account, then go to the installed extension and click on “Export”.


After we clicked on "Export", we need to create a "cookies.json" file in the folder where the script file is located.

After creating the file, we paste into it what we copied when we clicked “Export”.

Create a file called main.py, where we paste the following code:

import asyncio
import re
from telebot.async_telebot import AsyncTeleBot
from EdgeGPT import Chatbot

BOT_TOKEN = 'token' # Instead of "token" insert the Telegram bot token that you received earlier
bot = AsyncTeleBot(BOT_TOKEN)

async def bing_chat(prompt):
# You need to create a cookies.json file in the folder. DO NOT CHANGE THE PATH, THE cookies.json FILE MUST BE IN THE FOLDER WITH THE SCRIPT!
gbot = Chatbot(cookiePath='./cookies.json')
response_dict = await gbot.ask(prompt=prompt)
return re.sub(r'\[\^\d\^\]', '', response_dict['item']['messages'][1]['text'])

@bot.message_handler(func=lambda message: True)
async def ask(message):
prompt = message.text
if not prompt:
await bot.reply_to(message, "Empty request")
sent_message = await bot.reply_to(message, "Request processing, please wait")
bot_response = await bing_chat(prompt)
await bot.edit_message_text(chat_id=sent_message.chat.id, message_id=sent_message.message_id, text=bot_response.replace('?\n\n', ''))
except Exception as e:
await bot.reply_to(message, "Bing has decided to stop talking to you for some reason! Check your cookies!") # This happens when a topic comes up that Bing doesn't want to discuss

async def main():
await bot.infinity_polling()

if __name__ == "__main__":

After inserting the code, replace the token with the Telegram bot token that we received earlier (the token must be in quotes).

We do not touch the path to cookies.json! This file must be in the folder with the script!

Attention: At this stage we should have 2 files in one folder: “main.py” and “cookies.json”, which will be needed in both Linux and Windows!

The instructions on Windows are extremely simple and brief.

We need Python to run the script. Let's install 3.10.6.

Download the installation file from the official website:

Be sure to click on the “Add Python 3.10 to PATH” checkbox.


Open the console and enter the following command

pip install EdgeGPT --upgrade && pip install pyTelegramBotAPI && pip install aiohttp

After installing the libraries, run the script by double-clicking on the file with the .py extension, rejoice!

Instructions for Linux

After you have rented a virtual server, you need to log into it, we will do this through Bitvise SSH Client.

Follow this link: bitvise.com/ssh-client-download, click on “Bitvise SSH Client installer”, install the downloaded .exe file.

After installation we find ourselves in the following menu:


If you installed Ubuntu, then enter “root” in the Username field; In the Host field, enter the server IP, set Initial Method to “password”, enter the password.

Now click “Log in”, click “Accept and Save”.

Now click "New Terminal Console" in the left menu.


Now we are in the server console. To make further actions clear: On Linux, you need to paste what you copied to the clipboard by right-clicking in the console.

After starting the server, enter the following into the console:

apt update && apt upgrade && apt install pip && apt install screen && sudo apt-get install python3.10

With this command we installed Python of the required version, installed pip, updated apt, installed screen.

On Linux, for the script to work 24/7, you need to install Screen, which we did above.

Now click "New SFTP windows":


We are in the server files, in the "root" folder.

Right-click on the server file system, click on “Create folder”, create a folder called “bing”.


Go to the created folder by double clicking.

Now we transfer two files there: Script with the extension .py, and cookies.json

Now we return to the server console.

We write "cd bing".

Next we enter the following command:

pip install EdgeGPT --upgrade && pip install pyTelegramBotAPI && pip install aiohttp

Now, if you did everything according to the guide, we enter the following command:

screen -S bing python3 main.py

Thus, if no error occurs, you have launched the script to work 24/7, now you simply close the terminal and exit the server, checking the functionality of the script.



Reaction score
Who tried it?