Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Python library for intercept, a game by bubmet

Project description

Intercept.py

Python library for intercept, a game by bubmet

Styled after discord.py, this library aims to give users a customizable experience with the game.

Examples

Chat logger:

from intercept import Client, DataFormat, ChatEvent

client = Client(username, password, handle_data=DataFormat.CLEAN)


@client.event
async def event_chat(event: ChatEvent):
    print(event.msg)

client.run()

Simple custom client using prompt-toolkit:

from prompt_toolkit import prompt
from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop
from prompt_toolkit.patch_stdout import patch_stdout

from intercept import Client, DataFormat, MessageEvent

use_asyncio_event_loop()

client = Client(username, password, handle_data=DataFormat.ANSI)


@client.event
async def on_event(event):
    if isinstance(event, MessageEvent):
        print(event.msg)


@client.event
async def event_ready():
    while client.handler._do_loop:  # pylint: disable=protected-access
        with patch_stdout():
            text = await prompt(" >> ", async_=True)

        if text == "quit":
            client.stop()
        else:
            await client.command(text)
    print("Done running")


client.run(backend='asyncio')

More examples can be found here

Project details


Download files

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

Files for intercept.py, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size intercept.py-0.1.1-py3.6.egg (14.7 kB) File type Egg Python version 3.6 Upload date Hashes View
Filename, size intercept.py-0.1.1-py3.7.egg (14.8 kB) File type Egg Python version 3.7 Upload date Hashes View
Filename, size intercept.py-0.1.1-py3-none-any.whl (7.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size intercept.py-0.1.1.tar.gz (5.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page