Skip to content

GridexX/XWiki-Matrix-Bot

Repository files navigation

logo

MatriXWiki

An awesome bot to connect XWiki to Matrix !

contributors last update forks stars open issues license


📔 Table of Contents

🌟 About the Project

This project aims to retrieve information located in a XWiki instance from to a Matrix Bot. It uses under the hood the REST APi of XWiki and ChatGPT to provide resume of Wiki's pages.

🎯 Features

  • Search pages in the wiki and get a summary of each of them
  • Retrieve the list of users
  • Ask for questions resumed from the Wiki

🔑 Environment Variables

To run this project, you will need to copy the .env.example file into a .env and fill values for all variables.

⚠️ You will need an API_KEY in order to use ChatGPT resume functions !

🧰 Getting Started

‼️ Prerequisites

  • This project uses Npm as package manager.
  • A Matrix Bot setup is needed to query commands. You can follow this tutorial to creates one.

⚙️ Installation

  1. Clone the project

    git clone https://github.com/GridexX/XWiki-Matrix-Bot.git
  2. Go to the project directory

    cd XWiki-Matrix-Bot
  3. Install dependencies

    npm install
  4. Start the application in development mode

      npm run start:dev

🚩 Deployment

To deploy this project, you should first completed the getting started and follow those steps

  1. Compile TypeScript code into JavaScript:

    npm run build
  2. Build the Docker image:

    docker build . -t <NAME>
  3. Upload the image to the docker hub

    docker push <NAME>
  4. Then run the image into a production server:

docker run <options> <NAME>

🔭 Project structure

This is a somewhat opinionated template that is runnable out of the box. The project is TypeScript with a linter that matches the bot-sdk itself. All the good bits of the bot are under src/.

src/index.ts

This is where the bot's entry point is. Here you can see it reading the config, preparing the storage, and setting up other stuff that it'll use throughout its lifetime. Nothing in here should really require modification - most of the bot is elsewhere.

src/commands/handler.ts

When the bot receives a command (see index.ts for handoff) it gets processed here. The command structure is fairly manual, but a basic help menu and processing for a single command is there.

src/commands

Here are located the commands functions used. Type aibot help to have a list of the available comands

src/config.ts

This is simply a typescript interface for your config so you can make use of types.

lib/

This is where the project's build files go. Not really much to see here.

storage/

This is the default storage location. Also not much to see here.

👋 Contributing

Contributions are always welcome!

⚠️ License

Distributed under the Apache License. See LICENSE.md for more information.

🤝 Contact

GridexX - @gridexx - arsene582@gmail.com

Project Link: https://github.com/GridexX/XWiki-Matrix-Bot