- Python 100%
* applied checks to dev branch * add pin and unpin msg (#46) * improve guild caching, cache replies (#47) * Contributing (#51) * ban AI contributions * fix format * Add support for triggering the typing indicator in a channel (#54) * add support for triggering a typing indicator in a channel * forgot return statement oopsie * allow custom prefix handlers for Bot (#53) * allow custom prefix handlers for Bot * ignore typecheck here since it should always be available * Contribution guidelines (#58) * Remove contributing section from README Removed the contributing section and related instructions. * Update CONTRIBUTING.md with contribution guidelines Added guidelines for contributions and moved environment setup from the readme. * add Client.get_guild (#59) * add `ban_duration_seconds` to `Guild.ban` (#60) * Fixed name representation for unicode emojis & sorted commands for cogs (#57) * Fix for https://github.com/akarealemil/fluxer.py/issues/55 * Fixed name representation for unicode emojis * Fixed pyright (type checking) fail * fixed lint fail * Improvements for repository contributions (#61) * Added pull request template * Improved contribution guidelines * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Viv Verner <140846346+PerpetualPossum@users.noreply.github.com> * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Viv Verner <140846346+PerpetualPossum@users.noreply.github.com> --------- Co-authored-by: Viv Verner <140846346+PerpetualPossum@users.noreply.github.com> * Added issue templates (#63) * Added issue templates * Delete .github/ISSUE_TEMPLATE/form.yml sorry lol * Apply suggestions from code review Co-authored-by: Viv Verner <140846346+PerpetualPossum@users.noreply.github.com> --------- Co-authored-by: Viv Verner <140846346+PerpetualPossum@users.noreply.github.com> * Standarized embed handling for message.send and channel.send (#64) * Unified embed handling for message.send and channel.send * Fixed ruff formatting * Added from_dict to Embeds class (#65) * Added from_dict method to embed class * Ruff and pyright fixes * Fixed ruff check * Added escape_mentions util method (#73) * add setup hook (#67) * dont silently drop closed sockets (#68) * Added basic bot example (#71) * Added basic bot example * Updated usage steps with requirements * Added subclassed bot example (#72) * Added subclassed bot example * Updated usage steps and requirements * release 0.4.2 (#75) --------- Co-authored-by: Viv Verner <140846346+PerpetualPossum@users.noreply.github.com> Co-authored-by: hn1f <hn1f@proton.me> Co-authored-by: Ravener <ravener.anime@gmail.com> Co-authored-by: creeperita09 <creeperita104@jcjenson.net> Co-authored-by: Fer2G <123048581+Fer2G@users.noreply.github.com> |
||
|---|---|---|
| .github | ||
| examples | ||
| fluxer | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| CHANGELOG.md | ||
| fluxer_rest.json | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
A Python API wrapper for Fluxer.
Build bots and automated clients with a clean, type-safe, and event-driven architecture.
Features
- Async-first design built on
asyncio - REST API support with automatic rate limiting
- WebSocket gateway for real-time events
- Command framework with decorators
- Modular cog system
- Strongly-typed data models
- Structured error handling and retry logic
- Clean separation between low-level
Clientand high-levelBot
Installation
pip install fluxer.py
Requires Python 3.10 or higher.
Voice support
Voice requires LiveKit and ffmpeg:
pip install fluxer.py[voice]
or
uv add fluxer.py --extra voice
ffmpeg must be installed separately and available on your PATH.
On macOS (assuming you have Brew):
brew install ffmpeg
On Debian/Ubuntu:
apt install ffmpeg
On Windows: (assuming you have Chocolatey)
choco install ffmpeg
For development:
git clone https://github.com/akarealemil/fluxer.py.git
cd fluxer.py
pip install -e .
Template
A batteries-included template is available to get you started quickly with a new bot project.
Quick Start
A simple bot with a ping command:
import fluxer
bot = fluxer.Bot(command_prefix="!", intents=fluxer.Intents.default())
@bot.event
async def on_ready():
print(f"Bot is ready! Logged in as {bot.user.username}")
@bot.command()
async def ping(ctx):
await ctx.reply("Pong!")
if __name__ == "__main__":
TOKEN = "your_bot_token"
bot.run(TOKEN)
Choosing Between Bot and Client
Bot
Use Bot if you need: - Decorator-based commands - Built-in command
parsing - Cog support - Rapid bot development
Client
Use Client if you need: - Full event-driven control - A custom command
framework - Lower-level API interaction - Advanced or specialized
implementations
Architecture Overview
Bot extends Client, adding a command framework on top of the core
event system.
Core components:
HTTPClient-- Handles REST requests and rate limitsGateway-- Manages WebSocket connection and event dispatchClient-- Base event-driven interfaceBot-- High-level command frameworkCog-- Modular command grouping system
Data Models
fluxer.py provides strongly-typed models representing Fluxer entities:
GuildChannelMessageUserGuildMemberVoiceStateWebhookEmbedEmoji
Models encapsulate both state and behavior, exposing convenience methods such as:
Message.reply()Channel.send()Guild.kick_member()
Voice
Requires fluxer.py[voice] and ffmpeg
@bot.command()
async def play(ctx, channel_id: int, *, path: str):
channel = await bot.fetch_channel(str(channel_id))
async with await channel.connect(bot) as vc:
await vc.play_file(path)
For background playback with an after callback:
async with await channel.connect(bot) as vc:
vc.play(fluxer.FFmpegPCMAudio("music.mp3"), after=lambda e: print("done"))
# bot continues handling commands while audio plays
Pause and resume mid-playback:
vc.pause()
vc.resume()
print(vc.is_paused) # bool
FFmpegPCMAudio accepts the same options as discord.py's FFmpegPCMAudio:
| Parameter | Description |
|---|---|
executable |
Path to ffmpeg binary (default: "ffmpeg") |
before_options |
Arguments inserted before -i (e.g. "-ss 30" to seek) |
options |
Arguments inserted after the source (e.g. "-filter:a volume=0.5") |
sample_rate |
Output sample rate in Hz (default: 48000) |
num_channels |
1 for mono, 2 for stereo (default: 2) |
Intents
Intents determine which events your application receives from the
WebSocket gateway.
Common usage:
fluxer.Intents.default()
fluxer.Intents.all()
Limiting intents improves performance and ensures your application subscribes only to necessary events.
Exceptions
All library exceptions inherit from:
FluxerException
Errors include:
- HTTP errors mapped to REST status codes
- Gateway protocol errors
- Connection and retry-related failures
Documentation
Full documentation is available at:
