# henryxiaoyang/xybot architecture

> Architecture diagram of the GitHub repository henryxiaoyang/xybot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/henryxiaoyang/xybot
- Repository: https://github.com/henryxiaoyang/xybot

## Overview

##### Project Type and Purpose
- XYBot is a WeChat bot that interacts with WeChat via hooks. It provides both user-oriented and administrator features such as weather queries, news, ChatGPT integration, game queries, and more.
- The system is highly customizable through self-written plugins, and it supports scheduled tasks (“plans”) and dynamic plugin management. Deployment is supported via Docker as well as native Windows execution.

##### File Structure
- Top-Level Directories:
- Docker: Contains Dockerfile, docker-compose.yaml, and related shell scripts for containerized deployment.
- docs: Contains documentation files, deployment guides, and instructions for both Linux and Windows.
- plugins: Organized into several subdirectories (e.g., command, image, join_group, mention, text, voice) that encapsulate the distinct functionalities of the bot.
- plans: Contains scheduled tasks (Python scripts) that automate recurring activities (e.g., cache clearing, daily greetings).
- utils: Holds core utility modules that include the plugin manager, database interaction, and the primary XYBot integration logic.
- wcferry_helper: Integrates with WeChat and possibly acts as an adapter between the bot and the underlying WeChat communication layer.
- main_config.yml and start.py: Represent configuration and the primary entry point used to boot the application.
- Other notable files include CI/CD configurations in .github, licensing, and the overall README for instructions and feature details.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Deployment & CI/CD"
        CICD["CI/CD Pipeline"]:::cicd
        DEP["Docker Deployment"]:::deployment
    end

    subgraph "Core System"
        WIF["WeChat Integration"]:::integration
        CBE["Core Bot Engine"]:::core
        PLG["Plugin Manager & Plugins"]:::plugin
        STA["Scheduled Tasks Manager"]:::schedule
        CFG["Configuration Management"]:::config
    end

    ext[/"External Services (Weather,News,ChatGPT,Games)"/]:::ext

    ext -->|"triggers"| WIF
    WIF -->|"forwards"| CBE
    CBE -->|"dispatches"| PLG
    STA -->|"triggers"| CBE
    CBE <-->|"reads"| CFG
    CICD -->|"builds"| DEP
    DEP -->|"runs"| CBE

    %% Click Events
    click CBE "https://github.com/henryxiaoyang/xybot/blob/main/start.py"
    click CBE "https://github.com/henryxiaoyang/xybot/blob/main/utils/xybot.py"
    click PLG "https://github.com/henryxiaoyang/xybot/blob/main/utils/plugin_manager.py"
    click PLG "https://github.com/henryxiaoyang/xybot/blob/main/utils/plugin_interface.py"
    click PLG "https://github.com/henryxiaoyang/xybot/tree/main/plugins"
    click STA "https://github.com/henryxiaoyang/xybot/tree/main/plans"
    click WIF "https://github.com/henryxiaoyang/xybot/tree/main/wcferry_helper"
    click DEP "https://github.com/henryxiaoyang/xybot/tree/main/Docker"
    click CICD "https://github.com/henryxiaoyang/xybot/blob/main/.github/workflows/docker-build-on-merge.yml"
    click CFG "https://github.com/henryxiaoyang/xybot/blob/main/main_config.yml"

    %% Class Definitions
    classDef ext fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef core fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef plugin fill:#ffcc99,stroke:#333,stroke-width:2px;
    classDef schedule fill:#f0e68c,stroke:#333,stroke-width:2px;
    classDef integration fill:#d3d3d3,stroke:#333,stroke-width:2px;
    classDef deployment fill:#ffa07a,stroke:#333,stroke-width:2px;
    classDef cicd fill:#dda0dd,stroke:#333,stroke-width:2px;
    classDef config fill:#e6e6fa,stroke:#333,stroke-width:2px;

    class ext ext;
    class CBE core;
    class PLG plugin;
    class STA schedule;
    class WIF integration;
    class DEP deployment;
    class CICD cicd;
    class CFG config;
```
