mirror of
https://github.com/Paillat-dev/discord-progress-bar.git
synced 2026-01-02 09:06:21 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a2a5f4548 | |||
| c8734547f7 | |||
| 0e0ce97026 | |||
| a1d49f9648 |
46
README.md
46
README.md
@@ -58,7 +58,7 @@ Built on:
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install discord-progress-bar --prerelease=allow
|
pip install discord-progress-bar --pre
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
@@ -79,16 +79,23 @@ from discord_progress_bar import ProgressBarManager
|
|||||||
# Create a Discord bot with emoji caching enabled
|
# Create a Discord bot with emoji caching enabled
|
||||||
bot = discord.Bot(cache_app_emojis=True)
|
bot = discord.Bot(cache_app_emojis=True)
|
||||||
|
|
||||||
|
progress_bar_manager = None
|
||||||
|
progress_bar = None
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
|
"""Initialize the ProgressBarManager when the bot is ready."""
|
||||||
|
global progress_bar_manager, progress_bar
|
||||||
|
|
||||||
# Initialize the progress bar manager
|
# Initialize the progress bar manager
|
||||||
progress_bar_manager = await ProgressBarManager(bot)
|
progress_bar_manager = await ProgressBarManager(bot)
|
||||||
# Get a progress bar with the "green" style
|
# Get a progress bar with the "green" style
|
||||||
progress_bar = await progress_bar_manager.progress_bar("green")
|
progress_bar = await progress_bar_manager.progress_bar("green")
|
||||||
|
|
||||||
# Use it in your commands
|
|
||||||
@bot.slash_command()
|
@bot.slash_command()
|
||||||
async def show_progress(ctx, percent: float = 0.5):
|
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)}")
|
await ctx.respond(f"Progress: {progress_bar.partial(percent)}")
|
||||||
|
|
||||||
# Run your bot
|
# Run your bot
|
||||||
@@ -283,10 +290,9 @@ await self.progress_bar_manager.create_emojis_from_files("custom_style", custom_
|
|||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> Please be aware of the following limitations:
|
> 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
|
> - **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 app emoji limits (2'000 emojis per app - should be plenty for most use cases)
|
||||||
> - **Emoji Limits**: Subject to Discord's emoji limits (50 custom emojis for regular servers, 200 for servers with Nitro boosts)
|
|
||||||
> - **Pre-release Status**: This package is currently in alpha stage and may have unexpected behaviors or breaking changes in future versions
|
> - **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)
|
> - **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
|
## 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
|
### Contributing
|
||||||
|
|
||||||
1. Fork the repository
|
1. Fork the repository
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|||||||
[project]
|
[project]
|
||||||
name = "discord-progress-bar"
|
name = "discord-progress-bar"
|
||||||
dynamic = ["version", "urls", "readme"]
|
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 = [
|
authors = [
|
||||||
{ name = "Paillat-dev", email = "me@paillat.dev" }
|
{ name = "Paillat-dev", email = "me@paillat.dev" }
|
||||||
]
|
]
|
||||||
@@ -148,4 +148,4 @@ extend-ignore = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[tool.uv.sources]
|
[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
4
uv.lock
generated
@@ -120,7 +120,7 @@ dev = [
|
|||||||
requires-dist = [
|
requires-dist = [
|
||||||
{ name = "aiofile", specifier = ">=3.9.0" },
|
{ name = "aiofile", specifier = ">=3.9.0" },
|
||||||
{ name = "aiohttp", specifier = ">=3.11.18" },
|
{ 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]
|
[package.metadata.requires-dev]
|
||||||
@@ -235,7 +235,7 @@ wheels = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "py-cord"
|
name = "py-cord"
|
||||||
version = "2.6.1.dev233+gae38322c"
|
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 = [
|
dependencies = [
|
||||||
{ name = "aiohttp" },
|
{ name = "aiohttp" },
|
||||||
{ name = "typing-extensions" },
|
{ name = "typing-extensions" },
|
||||||
|
|||||||
Reference in New Issue
Block a user