Metadata-Version: 2.4
Name: botliysdk
Version: 1.0.1
Summary: The official API SDK for botliy.online
Home-page: https://github.com/Botliy/botliy-python
Author: Botliy
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25.1
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

<div align="center">
  <br />
  <p>
    <a href="https://botliy.online"><img src="https://botliy.online/img/logo.svg" width="546" alt="botliy" /></a>
  </p>
</div>

# Botliy Python SDK

The official API SDK for **[botliy.online](https://botliy.online)**. Easily communicate with our platform using Python to post your bot stats, check user votes, and authenticate webhooks seamlessly!

<div align="center">
  <a href="https://docs.botliy.online">📚 Read the Full Documentation</a> •
  <a href="https://discord.botliy.online">💬 Join our Discord</a>
</div>

## Installation

Install the package directly from PyPI:

```bash
pip install botliysdk
```
*(Requires Python 3.6+ and `requests`)*

---

## 🚀 Quick Start Example

Here is a simple example covering how to initialize the bot and use the SDK:

```python
from botliysdk import Botliy

# 1. Initialize the client
client = Botliy(
    api_token="your_api_token_here", 
    bot_id="your_bot_id_here",
    webhook_secret="your_optional_webhook_secret_here"
)

# 2. Post Bot Stats
# (It's recommended to do this on a loop every 30 minutes in your bot code)
client.post_stats(server_count=1500, shard_count=1)

# 3. Check if a user voted for your bot!
response = client.check_vote("some_user_discord_id")
if response.get("voted") == 1:
    print("This user cast a vote!")
else:
    print("This user has not voted.")
```

---

## 📖 API Methods

### `client.post_stats(server_count: int, shard_count: int = 1)`
Posts your bot's current server and shard numbers. Returns a dictionary mapping of the API's response.

### `client.get_stats()`
Will return a dictionary of your bot's stats currently registered on Botliy's servers.

### `client.get_votes()`
Will return a dictionary containing the last 1,000 votes for your bot.

### `client.check_vote(user_id: str)`
Checks whether a specific user ID has voted for your bot in the last 12 hours. The returned dictionary will contain `"voted": 1` if they have, or `0` if they have not.

### `client.verify_webhook(authorization_header: str)`
Utility method to seamlessly verify Discord webhook requests you receive on your HTTP server (Flask, FastAPI, etc.). Compare the `Authorization` header request sent to you against your configured Webhook secret. Returns `True` if it successfully matches!

---

> For detailed usage examples integrating `discord.py` and `Flask`, view our [Full API Reference Documentation](https://docs.botliy.online).
