Python library for intercept, a game by bubmet
Project description
# Intercept.py
Python library for [intercept](https://bubmet.itch.io/intercept), a game by [bubmet](https://github.com/bubmet)
Styled after [discord.py](https://github.com/Rapptz/discord.py) (async), this library aims to give users a customizable experience with the game.
# Examples
Chat logger:
```py
from intercept import Client, DataFormat, ChatEvent
client = Client(username, password, fmt=DataFormat.CLEAN)
@client.event
async def event_chat(event: ChatEvent):
print(event.msg)
client.run()
```
Simple custom client using [prompt-toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit):
```py
from prompt_toolkit import prompt
from intercept import Client, DataFormat, MessageEvent
client = Client(username, password, fmt=DataFormat.ANSI)
@client.event
async def on_event(event):
if isinstance(event, MessageEvent):
print(event.msg)
@client.event
async def event_ready():
while client._do_loop: # pylint: disable=protected-access
text = await prompt(" >> ", async_=True)
if text == "quit":
client.stop()
else:
await client.command(text)
client.run(backend='asyncio')
```
Python library for [intercept](https://bubmet.itch.io/intercept), a game by [bubmet](https://github.com/bubmet)
Styled after [discord.py](https://github.com/Rapptz/discord.py) (async), this library aims to give users a customizable experience with the game.
# Examples
Chat logger:
```py
from intercept import Client, DataFormat, ChatEvent
client = Client(username, password, fmt=DataFormat.CLEAN)
@client.event
async def event_chat(event: ChatEvent):
print(event.msg)
client.run()
```
Simple custom client using [prompt-toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit):
```py
from prompt_toolkit import prompt
from intercept import Client, DataFormat, MessageEvent
client = Client(username, password, fmt=DataFormat.ANSI)
@client.event
async def on_event(event):
if isinstance(event, MessageEvent):
print(event.msg)
@client.event
async def event_ready():
while client._do_loop: # pylint: disable=protected-access
text = await prompt(" >> ", async_=True)
if text == "quit":
client.stop()
else:
await client.command(text)
client.run(backend='asyncio')
```
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
intercept.py-0.0.1.tar.gz
(4.9 kB
view hashes)
Built Distributions
intercept.py-0.0.1-py3.7.egg
(13.8 kB
view hashes)
Close
Hashes for intercept.py-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c812b5481cfc0fd6bdedc32543a6a89635961704fea6259d1fe8d16f93a20eb0 |
|
MD5 | a4dc6cafb0deb9135f740c9fbba80488 |
|
BLAKE2b-256 | 731a07ab440a9fd438d8b92c4a35be0aa5bf4bc4b2514c5a3eb4ca476cd832a7 |