bot.weakauras_bot module
WeakAuras Discord Bot - Core Bot Implementation
This module contains the main WeakAurasBot class which extends discord.py’s commands.Bot with WeakAuras-specific functionality including server-specific macro storage, configuration management, and administrative features.
The bot provides: - Server-isolated macro storage and retrieval - Role-based permission system - Automatic folder management with guild ID matching - Branded embed creation for consistent UI - Server configuration management
Example
Creating and running the bot:
config = {"discord": {"tokens": {"dev": "your_token"}}}
bot = WeakAurasBot(config)
bot.run(config["discord"]["tokens"]["dev"])
- Module-level constants and imports for Discord bot functionality.
- class bot.weakauras_bot.WeakAurasBot(config)[source]
Bases:
Bot
WeakAuras Discord Bot with server-specific macro storage and management.
This bot extends discord.py’s commands.Bot to provide WeakAuras-specific functionality including macro storage, server configuration, and administrative features. Each Discord server gets its own isolated data storage.
- data_dir
Directory path for server data storage.
- Type:
Path
Example
>>> config = {"storage": {"data_directory": "server_data"}} >>> bot = WeakAurasBot(config) >>> # Bot is now ready for command registration and startup
- __init__(config)[source]
Initialize the WeakAuras bot with configuration.
- Parameters:
config (dict[str, Any]) – Configuration dictionary containing bot settings, storage paths, and other options.
Example
>>> config = { ... "storage": {"data_directory": "server_data"}, ... "bot": {"brand_color": 0x9F4AF3} ... } >>> bot = WeakAurasBot(config)
- get_server_folder(guild_id, guild_name)[source]
Get or create the server folder path, checking for existing folders by guild ID
- Return type:
Path
- get_server_macros_file(guild_id, guild_name)[source]
Get the macros file path for a specific server
- Return type:
Path
- save_server_macros(guild_id, guild_name, macros)[source]
Save macros for a specific server
- Return type:
- get_server_config_file(guild_id, guild_name)[source]
Get the configuration file path for a specific server
- Return type:
Path
- save_server_config(guild_id, guild_name, config)[source]
Save configuration for a specific server
- Return type:
- async is_event_enabled(guild_id, event_type)[source]
Check if a specific event is enabled for a server.
Checks Django database first, then falls back to JSON configuration.
- has_admin_access(member)[source]
Check if member has admin access via role names or Discord permissions
- Return type: