Writing

How to install phBot plugins, and what to check when one does not load

By Mohamed Gado · · 5 min read

To install a phBot plugin, copy its .py file into the Plugins folder inside your phBot folder and restart phBot. Each plugin opens in its own tab, named after the plugin. That is the whole install, and it is the same for every one of my phBot plugins. The rest of this page covers how phBot tells plugins apart, which files they write, how to update one, and what to look at when a tab does not show up.

Everything below is read from the plugin repo and its README, not from memory of the phBot menus.

How do I install a phBot plugin?#

  1. Download the .py file of each plugin you want, or the whole repo as a ZIP. All of them are free and MIT licensed.
  2. Copy the files into the Plugins folder inside your phBot folder.
  3. Restart phBot. A tab named after each plugin appears.

The README's per-plugin install steps also mention Reload Plugins as an alternative to a restart. The general steps say restart, so I do too.

You do not need to install them all. Two of them lean on others: xCaravan takes chat commands through xControl's leader list, and xNotify can send alerts for xCaravan trade runs.

How does phBot know which plugin is which?#

Each file starts with a few plain variables. xControl has these:

pName = 'xControl'
pVersion = '1.9.1'
pAuthor = 'JellyBitz, Vette1123 (Gado)'
pUrl = 'https://raw.githubusercontent.com/Vette1123/phbot-plugins/main/xControl.py'

pName is also the tab label. Every plugin builds its tab with QtBind.init(__name__, pName), so the name you see on the tab is whatever pName says, not the file name. The one place where they differ is xPacketTool, whose pName is spelled 'xPackeTool'. The tab, and the config file it writes, use that spelling.

The versions in the repo today:

File pName pVersion
xControl.py xControl 1.9.1
xCaravan.py xCaravan 1.0.0
xAutoConfig.py xAutoConfig 2.0.0
xMagicPop.py xMagicPop 2.1.0
xJupiter.py xJupiter 4.5
xShining.py xShining 4.1.2
xPacketTool.py xPackeTool 1.2.0
xNotify.py xNotify 1.4.1
xShadow.py xShadow 2.5.1_LOG_CLEAN
xSpeedSpear.py xSpeedSpear 4.1.0

Which plugins are there?#

Plugin What it does
xControl Controls a party of bots through in-game chat. A leader types commands and every bot running it reacts.
xCaravan Auto-Caravan and job route runner with a dashboard and per-character config.
xAutoConfig Per-character profile and config switcher, including the training script and DB3 sidecar files.
xMagicPop Magic Pop spinner that loops "play" packets across the Magic Pop items in your inventory.
xJupiter Jupiter Temple unique hunter with Search and Standby modes.
xShining iSRO lightstone crafting from Blue and Black Stones in the inventory.
xPacketTool Packet inspector and injector, with an opcode filter list.
xNotify Telegram and Discord alerts for death, bot stop, PMs, uniques and more.
xShadow Shadow Dungeon helper that runs entry, NPC steps, item retrieval and exit.
xSpeedSpear Chinese spear imbue and speed animation-cancel helper.

If you want the party-control one first, the xControl commands page lists every command. For alerts, see Telegram and Discord alerts.

What files do plugins write next to themselves?#

Plugins keep settings in JSON files, and a few use more. Only what the code shows:

  • xControl writes <server>_<character>.json inside an xControl folder under phBot's config directory. It creates the folder if it is missing. The leader list is saved there, per character.
  • xCaravan saves xCaravan_<character>.json in the config directory. The README gives the path as Plugins/Config/xCaravan_<character>.json. It also reads xControl's per-character file to check who may send CARAVAN commands.
  • xJupiter writes <server>_<character>_v3.json inside an xJupiter folder in the config directory.
  • xPacketTool writes xPackeTool.json in the config directory.
  • xNotify writes xNotify.json next to the plugin file, shared by every bot process, plus an xNotify_dedup folder next to it.
  • xSpeedSpear writes xSpeedSpear.json next to the plugin file.
  • xShadow writes a _storage_queue.json file, prefixed with its name, in the config directory.
  • xAutoConfig copies phBot's own .json settings and .db3 item filter files, including the -wal and -shm sidecars, between characters.

Back these up before you wipe a phBot folder. Your leader lists and routes live in them, not in the .py files.

How do I update a plugin?#

Replace the .py file in the Plugins folder with the new one and restart phBot. The settings files listed above are separate from the .py, so replacing the plugin file does not touch them. Eight of the ten have a pUrl pointing at the raw file in the repo, which is the file to download. xShadow's pUrl is just https://github.com/ and xSpeedSpear's is empty.

Why does a plugin not load?#

Check these in order:

  1. The file is in the wrong folder. It belongs in the Plugins folder inside the phBot folder.
  2. Nothing extra needs installing. Every plugin imports only Python's standard library plus the modules phBot supplies: phBot, QtBind, and for xControl phBotChat. That covers json, os, struct, time, sqlite3, threading, queue, urllib, hashlib, ctypes and shutil. There is no pip install step, and no third-party import in any of the ten files.
  3. You are looking for the wrong tab name. The tab shows pName. Look for xPackeTool if xPacketTool seems missing.
  4. Two files claim the same name. Both would label their tab with the same pName. Keep one copy of each plugin in the folder.
  5. The plugin loads but does nothing. xControl only obeys senders on that bot's leader list, and xCaravan chat commands depend on that list too.
  6. The log says why. Plugins write lines starting with Plugin: to the phBot log, for example when xAutoConfig fails to copy a file. Read the log before guessing.

If a plugin loads but you want to change it, the phBot Python API guide shows how to write your own plugin.

Are the plugins free?#

Yes. Every plugin in the repo is free and MIT licensed. phBot itself is a separate program with its own license.