Python Package
Install Package
To install package, you need to use PIP.
You can choose between Official version and Github Version
pip install openblacklist
Setup client
you need first to get a API-KEY on the OpenBlacklist DashBoard
from openblacklist import BlacklistClient
client = BlacklistClient(api_key="your-api-key",webhook_url="your-webhook-url",webhook_pass="your-webhook-pass")
Check if user is in blacklist
from openblacklist import BlacklistClient
import asyncio
client = BlacklistClient(api_key="your-api-key")
user_id = 1045412983674781766
# This function is awaited, you need to add await before it or use asyncio
user = asyncio.run(client.check_user(user_id))
print(user)
# => isBlacklisted=True user=User(id=1045412983674781766, username='patate.hyg', blacklisted_reasons=Reason(fr_fr='Menaces et intimidation.', en_gb='Threats and intimidation.', es_sp='Amenazas e intimidaciones.'))
Use POST Webhook
from openblacklist import BlacklistClient
from openblacklist.method.Type import BlacklistUser
client = BlacklistClient(webhook_url="your-webhook-url",webhook_pass="your-webhook-pass")
client.event("add")
async def on_add(user: BlacklistUser):
print("New user blacklisted: ", user.user.username)
print("Reason", user.reasons.en_gb)
client.event("remove")
async def on_add(user: BlacklistUser):
print("New user unblacklisted: ", user.user.username)
client.listen(port=3000)
Last updated