Skip to main content
Nicotine+ includes a powerful plugin system that allows you to extend and customize the application’s behavior using Python. Plugins can respond to events, add custom commands, filter messages, and much more.

Overview

Plugins are stored in two locations:
  • System plugins: Built-in plugins located in pynicotine/plugins/
  • User plugins: Your custom plugins in ~/.local/share/nicotine/plugins/ (or your configured data folder)
All plugins extend the BasePlugin class and can hook into various events throughout the application lifecycle.

Installing Plugins

1

Download the plugin

Plugins are typically distributed as .zip files or folders containing Python code and a PLUGININFO file.
2

Install via GUI

  1. Open Nicotine+ and go to Settings → Plugins
  2. Click the Install Plugin button
  3. Select the plugin .zip file
  4. The plugin will be extracted to your user plugins folder
3

Enable the plugin

  1. Find the newly installed plugin in the plugins list
  2. Check the box next to the plugin name to enable it
  3. The plugin will load immediately

Manual Installation

You can also manually install plugins by extracting them to your user plugins folder:

Plugin Structure

Every plugin requires at minimum:

Plugin Capabilities

Event Hooks

Plugins can hook into numerous events. Here are the most commonly used:

Chat Events

Search Events

Transfer Events

Connection Events

Return Codes

Event methods can return special codes to control message flow:
  • returncode["break"] (0) - Stop other plugins from processing, but let Nicotine+ handle it
  • returncode["zap"] (1) - Stop other plugins and block Nicotine+ from processing
  • returncode["pass"] (2) - Continue to next plugin (default if nothing returned)

Custom Commands

Plugins can register commands for chat rooms, private chats, and CLI:
Commands are invoked with /command in chat:

Plugin Settings

Plugins can define configurable settings:
Settings are automatically saved to the Nicotine+ config file and can be edited in the GUI.

Helper Methods

Sending Messages

Logging

Built-in Plugins

Nicotine+ includes several built-in plugins:
  • core_commands - Essential commands (always enabled)
  • spamfilter - Filter spam messages based on length and patterns
  • leech_detector - Detect users who download without sharing
  • now_playing_sender - Share currently playing music (MPRIS)
  • auto_buddy_rooms - Automatically join rooms of buddies
  • auto_user_browse - Auto-browse users who browse you
Examine the built-in plugins in pynicotine/plugins/ for real-world examples of plugin development.

Example: Spam Filter Plugin

Here’s a complete example of the built-in spam filter:

Advanced Features

ResponseThrottle

Prevent flooding when responding to user requests:

Accessing Core Components

Plugins have access to core Nicotine+ components:
Direct manipulation of core components should be done carefully. Prefer using the provided helper methods when possible.

Lifecycle Methods

Plugins can implement these lifecycle methods:

Uninstalling Plugins

To remove a plugin:
1

Disable the plugin

Uncheck the plugin in Settings → Plugins to disable it.
2

Uninstall

Click the Uninstall button next to the plugin (user plugins only).
Built-in system plugins cannot be uninstalled, only disabled.

Next Steps

  • Review built-in plugins in the source code at pynicotine/plugins/
  • Check the examplars plugin folder for additional examples
  • Read the BasePlugin API documentation