rdzobot 0.1.0

Modular, but monolithic Matrix bot
Documentation
// SPDX-License-Identifier: AGPL-3.0-or-later
// SPDX-FileCopyrightText: 2025 Wojtek Porczyk <woju@hackerspace.pl>

#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links)]

pub mod bot;
pub mod prelude;
pub mod utils;

pub use crate::bot::Rdzobot;

#[cfg(doc)]
pub mod module;

/*
 * Add your module below (3 times):
 */

#[cfg(feature = "mod-alertmanager")]
pub mod alertmanager;
#[cfg(feature = "mod-autojoin")]
pub mod autojoin;
#[cfg(feature = "mod-hswaw")]
pub mod hswaw;
#[cfg(feature = "mod-log")]
pub mod log;
#[cfg(feature = "mod-newag")]
pub mod newag;
#[cfg(feature = "mod-parcels")]
pub mod parcels;
#[cfg(feature = "mod-rcb")]
pub mod rcb;

pub(crate) fn load_modules(bot: Rdzobot) {
    #[cfg(feature = "mod-alertmanager")]
    crate::alertmanager::load(bot.clone());

    #[cfg(feature = "mod-autojoin")]
    crate::autojoin::load(bot.clone());

    #[cfg(feature = "mod-hswaw")]
    crate::hswaw::load(bot.clone());

    #[cfg(feature = "mod-log")]
    crate::log::load(bot.clone());

    #[cfg(feature = "mod-newag")]
    crate::newag::load(bot.clone());

    #[cfg(feature = "mod-parcels")]
    crate::parcels::load(bot.clone());

    #[cfg(feature = "mod-rcb")]
    crate::rcb::load(bot.clone());
}

#[derive(Debug, Default, serde::Deserialize)]
#[doc(hidden)]
#[serde(default)]
pub struct ModConfig {
    #[cfg(feature = "mod-alertmanager")]
    alertmanager: crate::alertmanager::Config,

    #[cfg(feature = "mod-autojoin")]
    autojoin: crate::autojoin::Config,

    #[cfg(feature = "mod-hswaw")]
    hswaw: crate::hswaw::Config,

    #[cfg(feature = "mod-log")]
    log: crate::log::Config,

    #[cfg(feature = "mod-newag")]
    newag: crate::newag::Config,

    #[cfg(feature = "mod-parcels")]
    parcels: crate::parcels::Config,

    #[cfg(feature = "mod-rcb")]
    rcb: crate::rcb::Config,

    // this is needed for doctests in module.rs to pass (use `cargo test -F mod-example`)
    #[cfg(feature = "mod-example")]
    pub example: ExampleConfig,
}

#[cfg(feature = "mod-example")]
#[doc(hidden)]
#[allow(dead_code, missing_docs)]
#[derive(Debug, Default, serde::Deserialize)]
pub struct ExampleConfig {
    pub enabled: bool,
}