chatgpt-telegram-bot icon indicating copy to clipboard operation
chatgpt-telegram-bot copied to clipboard

Queue for using the bot

Open tR4z8r opened this issue 1 year ago • 3 comments

How to add for users to wait their turn before using the bot?

tR4z8r avatar Jul 03 '23 15:07 tR4z8r

There's no such functionality at the moment. Will keep this open as a request

n3d1117 avatar Jul 03 '23 20:07 n3d1117

An example is something like this:

request_queue = asyncio.Queue()

async def process_queue():
    while True:       
        request = await request_queue.get()
                
        await make_request(request)
                
        request_queue.task_done()

async def make_request(request):
    #Code for executing a request to the bot
    ...

async def add_to_queue(request):   
    await request_queue.put(request)

#Creating and running the asyncio event loop
loop = asyncio.get_event_loop()
loop.create_task(process_queue())

tR4z8r avatar Jul 05 '23 15:07 tR4z8r

When will this problem be solved?

Newfpv avatar Sep 19 '23 13:09 Newfpv