Skip to main content

Прослойка между FunPayAPI и клиентом. [Исправленная версия]

Project description

FunPay API

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

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

Discord Сервер
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")  # отправляем ответное сообщение

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

FunPayPython-1.1.1.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

FunPayPython-1.1.1-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file FunPayPython-1.1.1.tar.gz.

File metadata

  • Download URL: FunPayPython-1.1.1.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for FunPayPython-1.1.1.tar.gz
Algorithm Hash digest
SHA256 2609dbca61b35c0e4d9bab88c91a727fbad75884398fe04956594b8ef88f1b24
MD5 9f47dad45d282fec0df6cff3e1b2a57c
BLAKE2b-256 7f8962a28e8748962adaee54fda25b81fef945dcb2387c5f0b0d8e904ab32735

See more details on using hashes here.

File details

Details for the file FunPayPython-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: FunPayPython-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for FunPayPython-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef7851f5ce4f446e1019555361d66ba40fa6d1c3cfdc895cab69c9f3dfed82d0
MD5 91e7f0c660423826c9361d0739f4303c
BLAKE2b-256 c4e75d56fcd47a049927245aeea9aaf4f306820062842c8eae51afc4f966eab8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page