4 Commits

Author SHA1 Message Date
4a2a5f4548 Set specific revision for py-cord and update installation command
Pinned py-cord dependency to a specific commit to ensure consistency and avoid unintended changes. Simplified the pip installation command for prerelease versions in the README.
2025-04-23 18:52:02 +02:00
c8734547f7 Update project description in pyproject.toml
Refined the project description to emphasize customizability and usage in Discord bot messages. Improves clarity and better conveys the library's purpose.
2025-04-23 18:45:09 +02:00
0e0ce97026 Update README with revised limitations and remove local testing setup
Adjusted the limitations section for clarity and updated emoji limits to reflect current app-wide constraints. Removed the local testing setup section, likely to streamline the README and focus on essential information.
2025-04-23 18:44:28 +02:00
a1d49f9648 Refactor progress bar setup and improve event handling.
Moved ProgressBarManager initialization to the `on_ready` event for better encapsulation. Updated `show_progress` to include a concise docstring and ensure consistent functionality.
2025-04-23 18:27:03 +02:00
3 changed files with 18 additions and 42 deletions

View File

@@ -58,7 +58,7 @@ Built on:
## Installation
```bash
pip install discord-progress-bar --prerelease=allow
pip install discord-progress-bar --pre
```
<!-- prettier-ignore -->
@@ -79,16 +79,23 @@ from discord_progress_bar import ProgressBarManager
# Create a Discord bot with emoji caching enabled
bot = discord.Bot(cache_app_emojis=True)
progress_bar_manager = None
progress_bar = None
@bot.event
async def on_ready():
"""Initialize the ProgressBarManager when the bot is ready."""
global progress_bar_manager, progress_bar
# Initialize the progress bar manager
progress_bar_manager = await ProgressBarManager(bot)
# Get a progress bar with the "green" style
progress_bar = await progress_bar_manager.progress_bar("green")
# Use it in your commands
@bot.slash_command()
async def show_progress(ctx, percent: float = 0.5):
@bot.slash_command()
async def show_progress(ctx, percent: float = 0.5):
"""Display a progress bar with the specified percentage."""
await ctx.respond(f"Progress: {progress_bar.partial(percent)}")
# Run your bot
@@ -283,10 +290,9 @@ await self.progress_bar_manager.create_emojis_from_files("custom_style", custom_
> [!WARNING]
> Please be aware of the following limitations:
>
> - **Python Version**: Requires Python 3.12 only
> - **Python Version**: Supports Python 3.12 only
> - **Discord Bot Framework**: Currently only supports py-cord, not discord.py or other Discord API wrappers
> - **Emoji Creation**: Requires bot permissions to create and manage emojis in at least one server
> - **Emoji Limits**: Subject to Discord's emoji limits (50 custom emojis for regular servers, 200 for servers with Nitro boosts)
> - **Emoji Limits**: Subject to Discord's app emoji limits (2'000 emojis per app - should be plenty for most use cases)
> - **Pre-release Status**: This package is currently in alpha stage and may have unexpected behaviors or breaking changes in future versions
> - **Custom Styles**: Creating custom styles requires providing all six emoji parts (LEFT_EMPTY, LEFT_FILLED, MIDDLE_EMPTY, MIDDLE_FILLED, RIGHT_EMPTY, RIGHT_FILLED)
@@ -308,36 +314,6 @@ If you encounter issues or have questions about discord-progress-bar:
## Development
### Local Testing
To set up a local development environment:
1. Clone the repository:
```bash
git clone https://github.com/Paillat-dev/discord-progress-bar.git
cd discord-progress-bar
```
2. Create a virtual environment and install dependencies:
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e ".[dev]" # Install the package in development mode with dev dependencies
```
3. Create a `.env` file with your Discord bot token:
```
DISCORD_TOKEN=your_discord_bot_token
```
4. Run the example bot:
```bash
python examples/basic.py
```
### Contributing
1. Fork the repository

View File

@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project]
name = "discord-progress-bar"
dynamic = ["version", "urls", "readme"]
description = "A python library to easily create progress bars with discord emojis"
description = "A Python library for creating customizable progress bars with Discord emojis in your Discord bot messages."
authors = [
{ name = "Paillat-dev", email = "me@paillat.dev" }
]
@@ -148,4 +148,4 @@ extend-ignore = [
]
[tool.uv.sources]
py-cord = { git = "https://github.com/Pycord-Development/pycord" }
py-cord = { git = "https://github.com/Pycord-Development/pycord", rev = "ae38322ca2bee850f3d05b0cbe80835a9e990986" }

4
uv.lock generated
View File

@@ -120,7 +120,7 @@ dev = [
requires-dist = [
{ name = "aiofile", specifier = ">=3.9.0" },
{ name = "aiohttp", specifier = ">=3.11.18" },
{ name = "py-cord", git = "https://github.com/Pycord-Development/pycord" },
{ name = "py-cord", git = "https://github.com/Pycord-Development/pycord?rev=ae38322ca2bee850f3d05b0cbe80835a9e990986" },
]
[package.metadata.requires-dev]
@@ -235,7 +235,7 @@ wheels = [
[[package]]
name = "py-cord"
version = "2.6.1.dev233+gae38322c"
source = { git = "https://github.com/Pycord-Development/pycord#ae38322ca2bee850f3d05b0cbe80835a9e990986" }
source = { git = "https://github.com/Pycord-Development/pycord?rev=ae38322ca2bee850f3d05b0cbe80835a9e990986#ae38322ca2bee850f3d05b0cbe80835a9e990986" }
dependencies = [
{ name = "aiohttp" },
{ name = "typing-extensions" },