Project Scripting Documentation
π¦ Allowed Imports
β
Standard Library
asyncio
os
sys
webbrowser
logging
dataclasses
typing
time
re
json
datetime
random
β
Third-party Packages
discord
(fromdiscord.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 bodymode
: One of"auto"
,"plain"
,"code"
,"image"
, or"just_image"
title
: Optional title for embed-like layoutfields
: Optional list of(name, value)
pairsfooter
: Optional footer stringdelete_after
: Time in seconds to auto-delete the message(s)attachments
: List of files to attachcode_lang
: Code language (used only incode
mode, default isansi
)
Modes
auto
: Usesconfig.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
fetch_guild
Functionasync 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 IDname
(str, optional) β Guild nameclient
β Connecteddiscord.Client
instance
Returns:
discord.Guild
object
Raises:
Exception
if neither ID nor name is provided, or no guild is found
π DiscordWebhook
Class
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
send
await webhook.send(url: str, message, retries: int = 3) -> bool
Sends a message to the webhook URL.
Accepted message
formats:
message
formats:str
: treated as plain contentWebhookMessage
: custom dataclassdiscord.Embed
: automatically wrappeddict
: used as-is
Parameters:
url
: Discord webhook URLmessage
: message payloadretries
: retry attempts on failure
Returns:
True
on success (204 No Content
)False
on failure or invalid URL
ποΈ delete
delete
await webhook.delete(url: str) -> bool
Deletes a webhook.
Parameters:
url
: Discord webhook URL
Returns:
True
on successful deletionFalse
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:
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 stringdetails
: Additional context (optional)notify
: IfTrue
, 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
Last updated