# Plugin Introduction :::info Table of Contents [[toc]] ::: ## Plugin Categories **Plugins** are extension modules of LangBot, which include two types of executable content: **event listeners** and **content functions**. Event listeners are driven by events during the main program's execution, while content functions are driven by content generated by GPT. Both driving methods are uniformly packaged within the plugin class. ### Event Listeners Plugins listen to various events during the operation of LangBot. When an event occurs, LangBot calls the registered listener of the plugin with relevant event information. Plugins can register listeners to be triggered under specified conditions. ### Content Functions Content functions differ from plugins triggered by events. During a conversation, when the dialogue content matches the description of a content function, GPT specifies the function to be called, and LangBot invokes it. This is implemented based on [GPT's Function Calling capability](https://platform.openai.com/docs/guides/gpt/function-calling), which is a function automatically called by GPT embedded in the conversation. > It's similar to the official ChatGPT plugins. For example, if we provide GPT with a function `access_the_web`, along with its detailed description and parameter descriptions, then when we engage in a conversation involving content like the following: ``` Q: Please search for QQ bot projects on GitHub. Q: Please search for some good cloud service provider websites for me. Q: Read and summarize this article: https://zhuanlan.zhihu.com/p/607570830 Q: Check the weather in Qingyuan today. ``` GPT will respond with a function call request for `access_the_web`, and LangBot will call the content function provided by the plugin, returning the call result to GPT to generate a new response. Of course, the function calling feature is not limited to web access; it can also implement functions such as image processing, scientific calculations, and itinerary planning. Theoretically, we can achieve the same functionality as `ChatGPT Plugins` through content functions. ## Plugin Usage ### Installation > This section only provides the basic installation method for plugins. For detailed instructions, please refer to the documentation of each plugin or consult its developer. #### Repository Cloning (Recommended) During runtime, use an administrator account to send a private message to the bot with `!plugin get ` to automatically fetch the source code and install the plugin. The program will automatically install the required libraries based on the `requirements.txt` file in the repository. For example, to install the `hello_plugin` plugin: ``` !plugin get https://github.com/RockChinQ/hello_plugin ``` After installation, restart the program. #### Manual Installation Place the obtained plugin program in the `plugins` directory. For specific usage, please refer to the documentation of each plugin or consult its developer. ### Management #### !plugin Commands ``` !plugin List all installed plugins !plugin get Install a plugin from a GitHub repository address (requires administrator privileges) !plugin update all Update all plugins (requires administrator privileges, only supports plugins installed from repositories) !plugin update Update a specific plugin !plugin del Delete a plugin (requires administrator privileges) !plugin on Enable a plugin (requires administrator privileges) !plugin off Disable a plugin (requires administrator privileges) !func List all content functions ``` #### plugins/plugins.json Configuration File When the program starts, it synchronizes the settings here with the actual loaded plugin settings. **This file is automatically generated by the program. Do not manually add or delete items; only modify the priority and enabled status.** After modification, a restart is required. Example: ```json "plugins": [ { "name": "Nahida", "description": "Hello Nahida", "version": "0.1", "author": "RockChinQ", "source": "", "main_file": "plugins/Nahida/main.py", "pkg_path": "plugins/Nahida/", "priority": 0, "enabled": true } ] ``` `source`: Source code address. If empty, it means this plugin does not support automatic updates by the program. `priority`: Plugin execution priority. During initialization and event calls, higher-priority plugins will be processed first. `enabled`: When set to false, the plugin will not be initialized or called. ## Plugin List Below is a partial list of plugins. For all plugins, please check [RockChinQ's Star Collection](https://github.com/stars/RockChinQ/lists/qchatgpt-%E6%8F%92%E4%BB%B6) - [WebwlkrPlugin](https://github.com/RockChinQ/WebwlkrPlugin) - Allows the bot to access the internet!! - [https://github.com/the-lazy-me/NewChatVoice](https://github.com/the-lazy-me/miHoYoVoice) - LangBot voice plugin, enabling voice chat using multiple TTS platforms - [Yuumi0221/URLMaskerPlugin](https://github.com/Yuumi0221/URLMaskerPlugin) - Used to mask (replace) URLs to comply with QQ official bot API restrictions on URLs in messages - [ElvisChenML/Waifu](https://github.com/ElvisChenML/Waifu) - A LangBot plugin aimed at using program logic combined with LLM to create realistic chatbots, exploring authentic chat experiences. - [Pevernow/LangBot_Plugin_Emoticon_v3](https://github.com/Pevernow/QChatGPT_Plugin_Emoticon_v3) - LangBot v3 compatible, an emoticon plugin based on online APIs. - [https://github.com/kirifujinagisa/RussianRoulette](https://github.com/kirifujinagisa/RussianRoulette) - A LangBot Russian Roulette game plugin - [https://github.com/kirifujinagisa/FileSender](https://github.com/kirifujinagisa/FileSender) - A LangBot plugin for sending specified local files to applicants - [https://github.com/ElvisChenML/GalgameMaker](https://github.com/ElvisChenML/GalgameMaker) - A LangBot plugin for quickly generating Galgames conducted in QQ conversations. - [https://github.com/zzseki/QChatGPT_Plugin_News](https://github.com/zzseki/QChatGPT_Plugin_News) - No description (guess from the repository name) - [https://github.com/zzseki/QChatGPT_Plugin_Weather ](https://github.com/zzseki/QChatGPT_Plugin_Weather)- No description (guess from the repository name) - [https://github.com/zzseki/QChatGPT_Plugin_Music](https://github.com/zzseki/QChatGPT_Plugin_Music) - No description (guess from the repository name) - [https://github.com/inkOrCloud/Markdown2IMG](https://github.com/inkOrCloud/Markdown2IMG) - LangBot plugin, converting markdown text into images for output - [https://github.com/Annalasu/QcPlugin_Md2QQImage](https://github.com/Annalasu/QcPlugin_Md2QQImage) - Displays md image links in messages as normal images - [https://github.com/the-lazy-me/SillyTavernPlugin](https://github.com/the-lazy-me/SillyTavernPlugin) - LangBot plugin, capable of transcribing SillyTavern character cards to adapt to LangBot's personality presets