Skip to content

aleksfolt/gigathonapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hi there, I'm AleksFolt

GigaChat Messenger Api

This is not the official library for the gigachat.ru messenger. We are not responsible for this project for all your actions you are responsible if you use this library

Authentication

  1. Go to gigachat.ru
  2. Register or log in to your existing account
  3. Open developer console: F12 or Ctrl + Shift + C
  4. Application → Cookies → https://gigachat.ru → Copy the value of PHPSESSID cookie.

Install

$ pip install gigathon-api==0.0.1

Usage

Import:

from gigachat-api import GigaChat
import asyncio

api_token = "your_token"

client = GigaChat(api_token, "leave it like that")

Usage:

async def main():
  last = None
  while True:
      messages = await client.get_messages(last=last)
      for message in messages:
          last = message
          if message[1] != last:
              if not message[1]:
                  continue
              prompt = message[1][1]
              if prompt == "":
                  continue
              response = prompt
              await client.send_message(response, message[0])

and:

if __name__ == "__main__":
    asyncio.run(main())

Authors

Created a library and did all the routine: Alekami649

Deployed to pypi, made a repository on github and came up with an idea (or maybe not): AleksFolt

PyPi: https://pypi.org/project/gigathon-api/0.0.1/

Releases

No releases published

Packages

No packages published

Languages