Skip to content

utility

Utility Module for Tux Bot.

This module provides common utility functions and helpers used throughout the Tux bot, including AFK management and shared functionality.

Modules:

  • afk

    Away From Keyboard (AFK) status management.

  • encode_decode

    Text encoding and decoding utilities.

  • ping

    Bot status and ping checking commands.

  • poll

    Interactive polling system for Discord.

  • remindme

    Reminder cog for Tux Bot.

  • run

    Code execution cog for running code snippets in various programming languages.

  • self_timeout

    Self-timeout functionality for Discord users.

  • timezones

    Timezone information and display commands.

  • wiki

    Wikipedia and wiki search functionality.

Functions:

  • add_afk

    Set a member as AFK, updates their nickname, and saves to the database.

  • del_afk

    Remove a member's AFK status, restores their nickname, and updates the database.

Classes

Functions

_generate_afk_nickname

Python
_generate_afk_nickname(display_name: str) -> str

Generate the AFK nickname, handling truncation if necessary.

Returns:

  • str

    The AFK nickname with [AFK] prefix.

add_afk async

Python
add_afk(
    db: DatabaseCoordinator,
    reason: str,
    target: Member,
    guild_id: int,
    is_perm: bool,
    until: datetime | NoneType | None = None,
    enforced: bool = False,
) -> None

Set a member as AFK, updates their nickname, and saves to the database.

del_afk async

Python
del_afk(db: DatabaseCoordinator, target: Member, nickname: str) -> None

Remove a member's AFK status, restores their nickname, and updates the database.