Skip to main content

FunPay API

Библиотека для легкого написания ботов FunPay.

Важные ссылки

Telegram чат
Документация
PyPi

Быстрый старт

Пример простого бота, который будет отвечать на сообщение с текстом «привет».

from FunPayAPI import Account, Runner, types, enums


TOKEN = "<golden_key>"

# Создаем класс аккаунта и сразу же получаем данные аккаунта.
acc = Account(TOKEN).get()

# Создаем класс "прослушивателя" событий.
runner = Runner(acc)


# "Слушаем" события
for event in runner.listen(requests_delay=4):
    # Если событие - новое сообщение
    if event.type is enums.EventTypes.NEW_MESSAGE:
        # Если текст сообщения == "привет" и оно отправлено не нами
        if event.message.text.lower() == "привет" and event.message.author_id != acc.id:
            acc.send_message(event.message.chat_id, "Ну привет...")  # отправляем ответное сообщение

Пример простого бота, который выдает товар при новом заказе, если в названии заказа есть слово «аккаунт».

from FunPayAPI import Account, Runner, types, enums


TOKEN = "<golden_key>"

# Создаем класс аккаунта и сразу же получаем данные аккаунта.
acc = Account(TOKEN).get()

# Создаем класс "прослушивателя" событий.
runner = Runner(acc)


# "Слушаем" события
for event in runner.listen(requests_delay=4):
    # Если событие - новый заказ
    if event.type is enums.EventTypes.NEW_ORDER:
        # Если "аккаунт" есть в названии заказа
        if "аккаунт" in event.order.description:
            chat = acc.get_chat_by_name(event.order.buyer_username, True)  # получаем ID чата по никнейму
            acc.send_message(chat.id, f"Привет, {event.order.buyer_username}!\n"
                                      f"Вот твой аккаунт:\n"
                                      f"Почта: mail@somemail.ru\n"
                                      f"Пароль: somepassword!123")  # отправляем ответное сообщение

Metadata

Release files for FunPayAPI 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for FunPayAPI 1.1.0
File Size Uploaded Provenance
FunPayAPI-1.1.0.tar.gz 45.6 kB Without provenance Details

Release files / FunPayAPI-1.1.0.tar.gz

Download URL FunPayAPI-1.1.0.tar.gz
Size 45.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c09500b5b461ac13052b8663bfeffad38399f531e0d2d1ff955afa504eda36c5
BLAKE2b-256 checksum
How to use checksums
fdc5880876330bcf636e3dc06c34738b1411a502a12d1e5344e128d9f7ca80f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for FunPayAPI 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page