3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00
pbot/doc/QuickStart.md

506 lines
22 KiB
Markdown
Raw Normal View History

2020-01-12 19:23:32 +01:00
# QuickStart
<!-- md-toc-begin -->
2021-09-06 21:45:02 +02:00
* [Installation](#installation)
* [Installing Perl](#installing-perl)
* [Installing PBot](#installing-pbot)
* [git (recommended)](#git-recommended)
* [Download zip archive](#download-zip-archive)
* [Initial Setup](#initial-setup)
* [Installing CPAN modules](#installing-cpan-modules)
* [Installing cpanminus](#installing-cpanminus)
* [Installing and using local::lib](#installing-and-using-locallib)
* [Using cpanminus](#using-cpanminus)
* [re::engine::RE2](#reenginere2)
* [Clone data-directory](#clone-data-directory)
* [Configuration](#configuration)
* [Recommended settings for IRC Networks](#recommended-settings-for-irc-networks)
* [Libera.Chat](#liberachat)
* [IRCnet](#ircnet)
* [Other networks](#other-networks)
* [Starting PBot](#starting-pbot)
* [Usage](#usage)
* [rlwrap](#rlwrap)
* [Overriding directories](#overriding-directories)
* [Overriding registry](#overriding-registry)
* [First-time start-up](#first-time-start-up)
* [Using default settings](#using-default-settings)
* [Using custom settings](#using-custom-settings)
* [Custom recommended settings](#custom-recommended-settings)
* [Custom recommended IRCnet/other network settings](#custom-recommended-ircnetother-network-settings)
* [Regular start-up](#regular-start-up)
* [Additional configuration](#additional-configuration)
* [Creating your bot owner admin account](#creating-your-bot-owner-admin-account)
* [Adding other users and admins](#adding-other-users-and-admins)
* [Adding channels](#adding-channels)
* [Further Reading](#further-reading)
* [Commands](#commands)
* [Factoids](#factoids)
* [Plugins](#plugins)
* [Modules](#modules)
<!-- md-toc-end -->
2020-01-12 19:23:32 +01:00
## Installation
2020-01-03 04:07:47 +01:00
### Installing Perl
PBot uses the [Perl programming language](https://www.perl.org/). Perl is usually
part of a base Linux install. If you do not have Perl installed, please see your
system's documentation to install it.
Some systems may ship with a minimal Perl installation. You may need to complete
the installation by, e.g., `yum install perl-core` on RHEL/CentOS or
`dnf install perl` on RHEL/CentOS 8 or Fedora.
If you do not have system administrator access, you can install Perl locally into
your home directory using, .e.g., [perlbrew](https://metacpan.org/pod/perlbrew),
[plenv](https://metacpan.org/release/TOKUHIROM/App-plenv-v1.2.0/view/bin/plenv),
[plx](https://metacpan.org/pod/App::plx), etc.
2020-01-03 04:07:47 +01:00
### Installing PBot
#### git (recommended)
2021-07-15 18:13:52 +02:00
The recommended way to install PBot is with `git`. This will allow you to easily update to
2020-01-03 06:44:34 +01:00
the latest version of PBot via the git update process by issuing the `git pull` command.
Also, if you become interested in contributing improvements to PBot, you will be able to
submit them through `git`.
2020-01-03 04:07:47 +01:00
The command to install with `git` is:
2021-07-15 18:13:52 +02:00
$ git clone --recursive https://github.com/pragma-/pbot.git
2020-01-03 04:07:47 +01:00
#### Download zip archive
Alternatively, you may [download a ZIP archive](https://github.com/pragma-/pbot/archive/master.zip).
2021-07-15 18:13:52 +02:00
If you want to use the [Plang](https://github.com/pragma-/Plang) scripting language within PBot, you'll
need to [download the Plang ZIP archive](https://github.com/pragma-/Plang/archive/master.zip) as well.
Extract it into `pbot/Plang` after you extract the PBot ZIP archive into `pbot`.
2020-01-28 04:52:53 +01:00
## Initial Setup
2021-07-15 18:13:52 +02:00
After git-cloning (or unpacking the ZIP archives) you should have a directory named
2020-01-03 04:07:47 +01:00
`pbot/` (or `pbot-master/`). It should contain at least these directories and files:
Name | Description
--- | ---
2021-07-15 18:20:31 +02:00
[`Plang/`](https://github.com/pragma-/Plang) | Plang scripting language
2021-08-16 04:42:09 +02:00
[`bin/`](../bin) | PBot executables (e.g., [`bin/pbot`](../bin/pbot))
[`data/`](../data) | Default data-directory
[`doc/`](../doc) | Helpful documentation
[`lib/`](../lib) | PBot source tree
[`modules/`](../modules) | External command-line executables invokable as PBot commands
[`updates/`](../updates) | Migration scripts run automatically by PBot after updates that modify data structures
[`cpanfile`](../cpanfile) | CPAN dependencies file
There are a few one-time configuration things we must do to get PBot's environment
ready. Once the following steps are completed there is no need to do them again.
### Installing CPAN modules
Some of PBot's features depend on the availability of Perl modules written by
third parties. To use such PBot features, the modules listed in the [`cpanfile`](../cpanfile)
file need to be installed.
This can be a lengthy process as each module may itself have a certain amount of
dependencies and sub-dependencies. Perl is an extremely collaborative community!
Fortunately, you only need to install the CPAN modules once.
You must have `make`, `perl`, a C compiler, a C++ compiler, OpenSSL or LibreSSL
2021-07-15 03:42:23 +02:00
or equivalent, libssl-dev, and other such tools and libraries installed.
#### Installing cpanminus
The [cpanminus](https://metacpan.org/pod/App::cpanminus) tool is a fast and
lightweight way to install CPAN modules.
There are several ways to install cpanminus. If you have `wget` instead of `curl`,
then replace `curl -L` in the following commands with `wget -O -`.
2021-07-15 03:39:24 +02:00
Option 1) Use your system package manager, e.g.:
$ apt install cpanminus
2021-07-15 03:39:24 +02:00
Option 2) Install to `~/perl5` (if you used, e.g., perlbrew to install Perl):
$ curl -L https://cpanmin.us | perl - App::cpanminus
2021-07-15 03:42:23 +02:00
Option 3) Download the `cpanm` script directly to `~/bin`:
$ cd ~/bin
$ curl -L https://cpanmin.us/ -o cpanm
$ chmod +x cpanm
#### Installing and using local::lib
If you prefer to install the CPAN modules into `~/perl5` you can use [`local::lib`](https://metacpan.org/pod/local::lib).
2021-07-15 03:39:24 +02:00
You may ignore this step if you installed Perl with, e.g., perlbrew or if you have
system administrator privilege and prefer to install the CPAN modules to the system
Perl location.
The following command will install and set-up local::lib in `~/perl5`:
$ cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
2021-07-15 05:47:35 +02:00
The local::lib set-up will be lost when you close your shell. To make the set-up permanent, add the
`eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)` command to your `.bashrc` or shell equivalent.
#### Using cpanminus
Ensure you have set your current working directory to where you have git cloned
or unzipped PBot. There should be a [`cpanfile`](../cpanfile) in the current
2021-08-16 04:42:09 +02:00
directory, along with [`lib/`](../lib) and [`bin/`](../bin) directories.
$ cd pbot (or pbot-master)
The CPAN modules may be installed with (assuming you do not need Windows support):
$ cpanm -n --installdeps . --with-all-features --without-feature=compiler_vm_win32
If you want to install the bare minimum CPAN modules required for PBot's core functionality,
you can use the following command. But be aware that several plugins and modules may not
function.
$ cpanm -n --installdeps .
You may then choose to install the missing CPAN modules on a feature-by-feature basis using:
$ cpanm -n --installdeps . --with-feature=... --with-feature=...
where `...` is an optional PBot feature listed in PBot's [`cpanfile`](../cpanfile).
#### re::engine::RE2
2021-07-15 18:13:52 +02:00
Perl's native regular expression engine is susceptible to [ReDoS](https://swtch.com/~rsc/regexp/regexp1.html)
attacks. To prevent this, PBot uses the `re::engine::RE2` module for user-submitted regular expressions.
If you could not install it through CPAN, you must install it manually.
* https://github.com/google/re2
* https://github.com/dgl/re-engine-RE2/
2020-01-03 04:07:47 +01:00
### Clone data-directory
2020-01-03 04:07:47 +01:00
PBot uses a data-directory to store all its configuration settings and data. You must
2020-01-28 04:52:53 +01:00
clone this data-directory for each instance of PBot you want to run, otherwise they
will become quite confused with each other and things will break horribly.
Here we clone the data-directory for two PBot instances, naming them after the
IRC network they will connect to:
$ cp -r data libera
2020-01-03 04:07:47 +01:00
$ cp -r data ircnet
2020-01-28 04:52:53 +01:00
Alternatively, you could name your new data directory after your bot's nickname:
2020-01-03 04:07:47 +01:00
$ cp -r data coolbot
2020-01-28 04:52:53 +01:00
### Configuration
2020-01-01 01:10:06 +01:00
PBot configuration is stored in a registry of key/value pairs grouped by sections.
2020-01-28 04:52:53 +01:00
For more information, see the [Registry documentation](Registry.md).
For initial first-time setup, you may configure registry settings via the PBot
command-line options. We'll show you [how to do that](#starting-pbot) soon! First, read on to
see what settings you should configure.
2019-12-31 11:33:42 +01:00
2020-01-28 04:52:53 +01:00
Alternatively, you can edit the `registry` file in your cloned data-directory.
2020-01-28 05:05:22 +01:00
See [editing registry file](Registry.md#editing-registry-file) for more
2020-01-28 04:52:53 +01:00
information.
2020-01-28 05:05:22 +01:00
Here is a table of basic initial settings you should configure:
Registry key | Description | Default value
--- | --- | ---:
2020-01-01 01:10:06 +01:00
irc.botnick | IRC nickname. This is the name people see when you talk. _Required._ | _undefined_
irc.username | IRC username. This is the `USER` field of your hostmask. | pbot3
irc.realname | IRC gecos/realname. This is the `general information` or `real-name` field, as seen in `WHOIS`. | https://github.com/pragma-/pbot
irc.server | IRC server address to connect. | irc.libera.chat
2021-07-10 18:44:25 +02:00
irc.port | IRC server port. | 6667 (secure port: 6697)
irc.identify_password | Password to authenticate with services or bots. | _undefined_
2021-07-11 07:47:33 +02:00
irc.sasl | Whether to use the IRCv3 SASL authentication mechanism. | 0 (1 to enable)
irc.tls | Whether to use TLS encryption. | 0 (1 to enable)
2020-01-01 06:55:17 +01:00
general.trigger | Bot trigger. Can be a character class containing multiple trigger characters. Can be overridden per-channel. | [!]
2020-01-01 01:10:06 +01:00
2020-01-28 04:52:53 +01:00
For a list of other available settings see [this table](Registry.md#list-of-known-registry-items) in the [Registry documentation](Registry.md).
#### Recommended settings for IRC Networks
##### Libera.Chat
2021-07-10 18:44:25 +02:00
The default settings are tailored for an insecure connection to the Libera.Chat IRC network.
2021-07-11 07:47:33 +02:00
To make the connection secure, set `irc.tls` to `1`. This will enable TLS encryption.
You may optionally set `irc.tls_ca_path` or `irc.tls_ca_file` if necessary. Be sure to
2021-07-10 18:44:25 +02:00
set `irc.port` to `6697` for the secure port.
It is strongly recommended that you register an account with NickServ and to enable SASL authentication.
Register your channels with ChanServ. You may request a host cloak from Libera staff. This will protect
your nickname, channels and IP address.
2021-06-12 11:13:26 +02:00
Once you register with NickServ, it is strongly recommended to enable `irc.sasl`. If you
choose not to use IRCv3 SASL authentication, then it is recommended to set these options:
<details><summary>Click to show recommended Libera.Chat settings with SASL disabled</summary>
2021-06-12 10:58:37 +02:00
2020-01-01 01:10:06 +01:00
Registry key | Description | Recommended value
--- | --- | ---:
irc.identify_password | Password to use to identify to NickServ | `<password>`
2020-01-01 06:55:17 +01:00
irc.randomize_nick | Randomize IRC nickname when connecting to server. PBot will change to `irc.botnick` when logged-in. This prevents users from monitoring the botnick to catch its IP address before it is identified. | 1
2020-01-01 01:10:06 +01:00
general.autojoin_wait_for_nickserv | Wait for NickServ login before auto-joining channels. This prevents PBot from joining channels before it is identified and cloaked. | 1
2020-01-01 06:55:17 +01:00
general.identify_command | Command to send to NickServ to identify. `$nick` will be replaced with `irc.botnick`; `$password` will be replaced with `irc.identify_password`. If you wish to login to a NickServ account different than the `irc.botnick` you may replace the `$nick` text with a literal value. | `identify $nick $password`
2021-06-12 10:58:37 +02:00
</details>
##### IRCnet
IRCnet is one of the oldest IRC networks still running. It has no Services like NickServ and ChanServ.
2020-01-01 01:10:06 +01:00
Instead, its nicknames and channels are protected by custom bots.
These settings may be useful:
<details><summary>Click to show recommended IRCnet settings</summary>
2021-06-12 10:58:37 +02:00
2020-01-01 01:10:06 +01:00
Registry key | Description | Default value| Recommended value
2020-01-01 01:12:22 +01:00
--- | --- | ---: | ---:
2020-01-01 01:10:06 +01:00
general.identify_nick | Who to /msg for login/identify/authentication. Defaults to NickServ, can be overridden to a custom bot. | NickServ | `<service botnick>`
2020-01-01 01:13:45 +01:00
general.identify_command | Command to send to `general.identify_nick` to login. | `identify $nick $password` | `<service bot command>`
2020-01-01 01:10:06 +01:00
general.op_nick | Who to /msg to request channel OP status. Defaults to ChanServ, can be overridden to a custom bot. | ChanServ | `<service botnick>`
2020-01-01 01:13:45 +01:00
general.op_command | Command to send to `general.op_nick` to request channel OP status. | `op $channel` | `<service bot command>`
2021-06-12 10:58:37 +02:00
</details>
##### Other networks
2021-06-12 10:58:37 +02:00
Other networks are untested. They should be very similiar to either Libera.Chat or IRCnet, and so one or both of the
2020-01-03 04:07:47 +01:00
recommended settings should suffice. If you have any issues, please [report them here](https://github.com/pragma-/pbot/issues)
2021-06-12 10:58:37 +02:00
or by sending `pragma-` a message on the Libera.Chat network.
2020-01-12 19:23:32 +01:00
## Starting PBot
2021-08-16 04:42:09 +02:00
The executable to start PBot is `bin/pbot`. You may create a symbolic
link to the `bin/pbot` executable in `$HOME/bin/` or in `/usr/local/bin/`.
2021-08-16 04:42:09 +02:00
If you choose not to install the `bin/pbot` file to your PATH, remember
to use `./bin/pbot` instead of `pbot` in the following examples.
2020-01-01 01:10:06 +01:00
### Usage
2020-01-28 06:32:18 +01:00
$ pbot [directory overrides...] [registry overrides...]
2020-01-01 01:10:06 +01:00
2020-09-22 23:05:25 +02:00
#### rlwrap
It is recommended to use the `rlwrap` program for command-line history if you use
the PBot STDIN interface.
$ rlwrap pbot [...]
2020-01-01 01:10:06 +01:00
#### Overriding directories
2020-01-03 04:41:39 +01:00
You may override PBot's default directory locations via the command-line.
$ pbot data_dir=/path/to/data modules_dir=/path/to/modules
2020-01-03 04:41:39 +01:00
2020-01-01 01:10:06 +01:00
#### Overriding registry
2020-01-03 04:41:39 +01:00
You may override any of your Registry values via the command-line. Any overrides made will be
saved to the `registry` file. You do not need to use the override every time you launch PBot.
2020-01-28 04:52:53 +01:00
$ pbot irc.botnick=coolbot irc.server=irc.example.com irc.port=6667 [...]
### First-time start-up
2021-06-12 10:58:37 +02:00
#### Using default settings
The default settings will connect to the Libera.Chat IRC network.
2020-01-28 04:52:53 +01:00
At minimum, the registry key `irc.botnick` must be set before PBot will connect to any IRC servers.
The following command will use the `coolbot` data-directory that we cloned in the [initial setup](#initial-setup),
2021-06-12 10:58:37 +02:00
and set the `irc.botnick` registry key to the same name. It will automatically connect to the Libera.Chat IRC network.
2020-01-28 04:52:53 +01:00
$ pbot data_dir=coolbot irc.botnick=coolbot
#### Using custom settings
To connect to a specific IRC server or to configure additional settings, you may
[override the directory paths](#overriding-directories) and [override the registry values](#overriding-registry). Read on to the next section for examples.
2021-06-12 10:58:37 +02:00
##### Custom recommended settings
2020-01-28 04:52:53 +01:00
The following command is based on the [Recommended settings for IRC Networks](#recommended-settings-for-irc-networks) section earlier in this document.
2021-06-12 10:58:37 +02:00
The `irc.server` and `irc.port` settings are omitted because the default values will connect to the Libera.Chat IRC network.
2020-01-28 04:52:53 +01:00
Replace the placeholders, marked `X`, with values you want to use. Note that this is just for the first-time start-up. Regular subsequent start-up needs only `data_dir` to be overridden.
* If you have registered your botnick with the NickServ service, update the `irc.identify_password` entry in the `registry` file in your bot's data directory and then use this command:
2020-01-28 04:52:53 +01:00
2021-06-12 11:08:19 +02:00
`pbot data_dir=X irc.botnick=X irc.sasl=1`
2020-01-28 04:52:53 +01:00
2020-01-28 05:05:22 +01:00
* Otherwise, use this one:
2020-01-28 04:52:53 +01:00
2021-06-12 11:08:19 +02:00
`pbot data_dir=X irc.botnick=X`
2020-01-28 04:52:53 +01:00
##### Custom recommended IRCnet/other network settings
The following command is based on the [Recommended settings for IRC Networks](#recommended-settings-for-irc-networks) section earlier in this document.
Replace the placeholders, marked `X`, with values you want to use. Note that this is just for the first-time start-up. Regular subsequent start-up needs only `data_dir` to be overridden.
2020-01-28 05:05:22 +01:00
* If you want PBot to identify with a custom bot or service on IRCnet/other networks, use this command:
2020-01-28 04:52:53 +01:00
2021-06-12 11:08:19 +02:00
`pbot data_dir=X irc.botnick=X irc.server=X irc.port=X general.identify_nick=X general.op_nick=X`
2020-01-28 04:52:53 +01:00
2020-01-28 05:05:22 +01:00
* Otherwise, use this one:
2020-01-28 04:52:53 +01:00
2021-06-12 11:08:19 +02:00
`pbot data_dir=X irc.botnick=X irc.server=X irc.port=X`
2020-01-28 04:52:53 +01:00
### Regular start-up
After your initial start-up command, you only need to use the `data_dir`
2020-01-28 05:05:22 +01:00
directory override when starting PBot. Any previously used registry overrides
2020-01-28 05:11:03 +01:00
have been saved to your data-directory's `registry` file.
2020-01-28 04:52:53 +01:00
$ pbot data_dir=X
## Additional configuration
Once you've launched PBot, you can type directly into its terminal to execute
commands as the built-in PBot console admin user account. This will allow you
to use admin commands to create new users or join channels.
2020-01-28 05:05:22 +01:00
### Creating your bot owner admin account
2021-07-15 18:13:52 +02:00
To create your own fully privileged admin user account, use the [`useradd`](Commands.md#useradd)
command in the PBot terminal console. Its usage is:
useradd <username> <hostmasks> [channels [capabilities [password]]]
2020-01-28 04:52:53 +01:00
2021-07-15 18:13:52 +02:00
Suppose your nick is `Bob` and your hostmask is `Bob!~user@some.domain.com`. Use the following command:
2020-01-28 04:52:53 +01:00
2020-04-24 01:19:36 +02:00
useradd Bob Bob!~user@*.domain.com global botowner
2020-01-28 04:52:53 +01:00
This will create a user account named `Bob` with the `botowner` [user-capability](Admin.md#user-capabilities) that can administrate
2020-01-28 05:05:22 +01:00
all channels. Note the wildcard replacing `some` in `some.domain.com`. Now as long as
your connected hostmask matches your user account hostmask, you will be recognized.
2020-01-28 04:52:53 +01:00
It is very important that user account hostmasks are defined as strictly or as narrowly
as possible to match only the person it is intended for. Ideally, the user would have a
NickServ account, a user-cloak given by the staff of the IRC server or a unique DNS name.
2020-01-28 04:52:53 +01:00
In your own IRC client, connected using the hostmask we just added, type the
following command, in a private `/query` or `/msg`:
2020-01-03 04:41:39 +01:00
2020-01-28 04:52:53 +01:00
my password
2020-01-01 01:10:06 +01:00
2020-01-28 04:52:53 +01:00
This will show you the randomly generated password that was assigned to your
user account. You can change it -- if you want to -- with:
2020-01-03 04:48:00 +01:00
2020-01-28 04:52:53 +01:00
my password <new password>
2020-01-03 04:48:00 +01:00
2020-01-28 04:52:53 +01:00
Then you can login with:
2020-01-28 04:52:53 +01:00
login <password>
Now you can use `/msg` in your own IRC client to administrate PBot, instead of
the terminal console.
2020-01-28 05:18:08 +01:00
### Adding other users and admins
2021-07-15 18:13:52 +02:00
To add users to PBot, use the [`useradd`](Admin.md#useradd) command. Its usage is:
2020-01-28 05:18:08 +01:00
2020-04-24 01:19:36 +02:00
useradd <username> <hostmasks> [channels [capabilities [password]]]
The `hostmasks` and `channels` arguments can be a comma-separated list of values.
If you omit the `capabilities` argument, the user will be a normal unprivileged user. See [user-capabilities](Admin.md#user-capabilities)
for more information about user-capabilities.
2020-01-28 05:18:08 +01:00
If you omit the `password` argument, a random password will be generated. The user
can use the [`my`](Commands.md#my) command to view or change it.
2021-07-15 18:13:52 +02:00
Users may view and change their own metadata by using the [`my`](Commands.md#my) command,
provided their hostmask matches the user account.
2020-01-28 05:18:08 +01:00
2020-01-28 06:03:07 +01:00
my [key [value]]
2020-01-28 05:18:08 +01:00
For more information, see the [Admin documentation](Admin.md).
2020-01-28 04:52:53 +01:00
### Adding channels
2020-01-03 04:41:39 +01:00
To temporarily join channels, use the `join` command.
join <channel>
To permanently add a channel to PBot, use the `chanadd` command. PBot will
automatically join permanently added channels.
chanadd <channel>
To configure a permanent channel's settings, use the `chanset` command:
chanset <channel> [key [value]]
You can `chanset` the following keys:
Name | Description | Default value
--- | --- | ---:
2020-01-03 04:48:00 +01:00
enabled | If set to false, PBot will not autojoin or respond to this channel. | 1
chanop | If set to true, PBot will perform OP duties in this channel. | 0
permop | If set to true, PBot will not de-OP itself in this channel. | 0
2020-01-03 04:41:39 +01:00
2021-09-16 06:13:12 +02:00
For more information, see the [Channels documentation](Admin.md#channel-management).
2020-01-03 04:41:39 +01:00
2020-01-12 19:23:32 +01:00
## Further Reading
That should get you started. For further information about PBot, check out these topics.
2020-01-03 05:25:57 +01:00
### Commands
2020-01-03 05:58:17 +01:00
PBot has several core built-in commands. You've seen some of them in this document,
2020-01-03 06:01:21 +01:00
for setting up channels and admins. Additional commands can be added to PBot through
2020-01-03 05:58:17 +01:00
Plugins and Factoids.
2020-01-28 04:52:53 +01:00
For more information, see the [Commands documentation](Commands.md).
2020-01-03 05:58:17 +01:00
2020-01-28 04:52:53 +01:00
### Factoids
2020-01-03 05:58:17 +01:00
Factoids are a very special type of command. Anybody interacting with PBot
2020-01-28 04:52:53 +01:00
can create, edit, delete and invoke factoids.
2020-01-03 05:58:17 +01:00
2020-01-28 04:52:53 +01:00
In their most basic form, a factoid merely displays the text the creator sets.
2020-01-03 05:58:17 +01:00
<pragma-> !factadd hello /say Hello, $nick!
<PBot> hello added to global channel.
2020-01-11 01:25:15 +01:00
2020-01-03 05:58:17 +01:00
<pragma-> PBot, hello
<PBot> Hello, pragma-!
2020-01-03 06:01:21 +01:00
Significantly more complex factoids can be built by using `$variables`, command-substitution,
2020-01-03 05:58:17 +01:00
command-piping, `/code` invocation, and more!
2020-01-10 08:29:58 +01:00
For more information, see the [Factoids documentation](Factoids.md).
2020-01-03 06:30:02 +01:00
2020-01-28 04:52:53 +01:00
### Plugins
Plugins provide optional PBot features. The default plugins loaded by PBot is set by
the [`plugin_autoload`](../data/plugin_autoload) file in your data-directory. To autoload additional plugins,
add their name to this file.
The plugins that come with PBot live in [`lib/PBot/Plugin/`](../lib/PBot/Plugin). Additional third-party
plugins may be installed to `~/.pbot/PBot/Plugin/`.
2020-01-28 04:52:53 +01:00
You may manually load plugins using the `plug` command.
plug <plugin>
You may unload plugins using the `unplug` command.
unplug <plugin>
Plugins can be quickly reloaded by using the `replug` command.
replug <plugin>
2020-01-03 05:58:17 +01:00
2020-01-28 04:52:53 +01:00
Currently loaded plugins may be listed with the `pluglist` command.
<pragma-> !pluglist
<PBot> Loaded plugins: ActionTrigger, AntiAway, AntiKickAutoRejoin, AntiNickSpam, AntiRepeat,
AntiTwitter, AutoRejoin, Counter, Date, GoogleSearch, Quotegrabs, RemindMe, UrlTitles,
Weather
For more information, see the [Plugins documentation](Plugins.md).
### Modules
2020-01-03 05:58:17 +01:00
Modules are external command-line executable programs and scripts that can be
2020-01-28 04:52:53 +01:00
loaded as PBot commands.
2020-01-03 05:58:17 +01:00
Suppose you have the [Qalculate!](https://qalculate.github.io/) command-line
program and you want to provide a PBot command for it. You can create a _very_ simple
shell script containing:
#!/bin/sh
qalc "$*"
And let's call it `qalc.sh` and put it in PBot's `modules/` directory.
2020-01-28 04:52:53 +01:00
Then you can use the PBot [`load`](Admin.md#load) command to load the `modules/qalc.sh` script as the `qalc` command:
!load qalc qalc.sh
2020-01-28 04:52:53 +01:00
Now you have a [Qalculate!](https://qalculate.github.io/) calculator in PBot!
2020-01-03 05:58:17 +01:00
<pragma-> !qalc 2 * 2
<PBot> 2 * 2 = 4
2020-01-10 08:29:58 +01:00
For more information, see the [Modules documentation](Modules.md).