Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bloxlink/bloxlink-lib
Abstracted algorithms and utility functions for Bloxlink
https://github.com/bloxlink/bloxlink-lib
Last synced: about 1 month ago
JSON representation
Abstracted algorithms and utility functions for Bloxlink
- Host: GitHub
- URL: https://github.com/bloxlink/bloxlink-lib
- Owner: bloxlink
- Created: 2024-01-28T16:50:42.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-11-11T19:12:23.000Z (about 2 months ago)
- Last Synced: 2024-11-11T19:29:08.396Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 431 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bloxlink Library
Contains the generic code used with Bloxlink. This code is not dependent on a platform (e.g. Discord) and is designed to port Bloxlink to any platform.## What this library does
* Determines which binds apply to a user
* Connects to MongoDB and provides database fetching functions
* Allows the retrieval of Roblox entities such as badges and groups
* Provides HTTP fetching functions and utilities## Usage
* Create an .env file in your project root with values from [this configuration file](https://github.com/bloxlink/bloxlink-lib/blob/master/bloxlink_lib/config.py)
* Import the library: `import bloxlink_lib`
* Use the library:
```pyfrom bloxlink_lib import get_user, RobloxGroup, fetch_typed, get_binds, BaseModel
# retrieve Roblox objects either using get_[identity_type] functions or using the classes:
roblox_user = await get_user(username="Roblox")
print(roblox_user.groups)roblox_group = RobloxGroup(id=1)
await roblox_group.sync()
print(roblox_group)# fetch an item from the internet
from typing import Anyclass Response(BaseModel):
success: bool
error: str = None
object: Anyobj = await fetch_typed(Response, "https://example.com")
print(obj.object)# which binds apply to the user?
guild_binds = await get_binds(guild_id=123)
print([await b.satisfies_for(roblox_user=roblox_user, ...) for b in guild_binds])```
## Run tests locally
```bash
$ poetry run pytest -v -s
```