Okuru Docs
  • Welcome
  • Getting Started
    • Creating an Account
    • Installation
    • Known Issues
  • Scripting API
    • Project Scripting Documentation
Powered by GitBook
On this page
  • 📦 Allowed Imports
  • ✅ Standard Library
  • ✅ Third-party Packages
  • ✅ Project Imports
  • Signature
  • Parameters
  • Modes
  • Returns
  • Notes
  • 🔍 fetch_guild Function
  • Parameters:
  • Returns:
  • Raises:
  • 🌐 DiscordWebhook Class
  • 📤 send
  • 🗑️ delete
  • ⚙️ Configuration System
  • Config Sections
  • Available Sections:
  • 🧾 Logger
  • Logging Levels:
  • 🔔 Notification API
  1. Scripting API

Project Scripting Documentation


📦 Allowed Imports

✅ Standard Library

  • asyncio

  • os

  • sys

  • webbrowser

  • logging

  • dataclasses

  • typing

  • time

  • re

  • json

  • datetime

  • random

✅ Third-party Packages

  • discord (from discord.py)

  • discord.ext

  • aiohttp

✅ Project Imports

from utils.webhook import DiscordWebhook
from utils.config import config
from utils.logger import logger
from utils.common import fetch_guild
from utils.msg.utils import do_edit

🔗 Import from:

from utils.msg.utils import do_edit

Creates a pseudo-embed message using formatting, images, or ANSI-styled code blocks. Supports multiple modes for flexibility and automatic deletion.

Signature

async def do_edit(
    ctx: Ctx,
    content: str,
    mode: Literal["auto", "plain", "code", "image", "just_image"] = "auto",
    title: Optional[str] = None,
    fields: Optional[list[tuple[str, str]]] = None,
    footer: Optional[str] = None,
    delete_after: Optional[float] = 30.0,
    attachments: Optional[list[discord.File]] = None,
    code_lang: str = "ansi",
)

Parameters

  • ctx: Discord context object (commands.Context or similar)

  • content: Main message body

  • mode: One of "auto", "plain", "code", "image", or "just_image"

  • title: Optional title for embed-like layout

  • fields: Optional list of (name, value) pairs

  • footer: Optional footer string

  • delete_after: Time in seconds to auto-delete the message(s)

  • attachments: List of files to attach

  • code_lang: Code language (used only in code mode, default is ansi)

Modes

  • auto: Uses config.General["Embed Mode"] to determine style.

  • plain: Renders content in rich text.

  • code: Uses ANSI formatting and boxed layout.

  • image: Converts content and fields into an image.

  • just_image: Sends content as a pure image.

Returns

  • A list of additional messages sent (if the original had to be split)

Notes

  • Messages are chunked and sent individually if too long.

  • Supports temporary messages via delete_after.


🔍 fetch_guild Function

async def fetch_guild(id: int = None, name: str = None, client: discord.Client = None)

Fetches a Discord guild using a connected discord.Client.

Parameters:

  • id (int, optional) – Guild ID

  • name (str, optional) – Guild name

  • client – Connected discord.Client instance

Returns:

  • discord.Guild object

Raises:

  • Exception if neither ID nor name is provided, or no guild is found


🌐 DiscordWebhook Class

🔗 Import from:

from utils.webhook import DiscordWebhook

Asynchronous manager for sending and deleting Discord webhook messages, with built-in rate limiting and error handling.


📤 send

await webhook.send(url: str, message, retries: int = 3) -> bool

Sends a message to the webhook URL.

Accepted message formats:

  • str: treated as plain content

  • WebhookMessage: custom dataclass

  • discord.Embed: automatically wrapped

  • dict: used as-is

Parameters:

  • url: Discord webhook URL

  • message: message payload

  • retries: retry attempts on failure

Returns:

  • True on success (204 No Content)

  • False on failure or invalid URL


🗑️ delete

await webhook.delete(url: str) -> bool

Deletes a webhook.

Parameters:

  • url: Discord webhook URL

Returns:

  • True on successful deletion

  • False if the URL is invalid or deletion fails


⚙️ Configuration System

🔗 Import from:

from utils.config import config

Config Sections

All sections behave like dictionaries and are accessed as:

config.<Section>["Key"]

Available Sections:

Section
Example Usage

config.General

config.General["Token"]

config.Notifications

config.Notifications["Enable Toasts"]

config.Snipers

config.Snipers["Nitro"]["Enabled"]

config.Loggers

config.Loggers["DM"]["Enabled"]

config.Embeds

config.Embeds["Deletion Delay"]

config.RPC

config.RPC["AppID"]


🧾 Logger

🔗 Import from:

from utils.logger import logger

Handles logging of system events with optional in-app notifications.

Logging Levels:

logger.info(message, details=None, notify=False)
logger.warning(message, details=None, notify=False)
logger.error(message, details=None, notify=False)
logger.success(message, details=None, notify=False)

Parameters:

  • message: Main log string

  • details: Additional context (optional)

  • notify: If True, creates a notification


🔔 Notification API

logger.get_notifications(unread_only=False)
  • Returns list of notifications, newest first

  • Set unread_only=True to filter unread ones

logger.mark_notification_read(notification_id)
  • Marks a single notification as read

logger.mark_all_read()
  • Marks all notifications as read

logger.clear_notifications()
  • Deletes all stored notifications

PreviousKnown Issues

Last updated 20 days ago