Skip to content

Martmists-GH/intercept.py

Repository files navigation

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.

Additionally, I've made a custom client for intercept using intercept.py, which can be found here.

About

Python library for intercept

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages