███████╗ ██████╗██████╗        ██████╗ ███████╗ █████╗ 
██╔════╝██╔════╝██╔══██╗      ██╔═████╗╚════██║██╔══██╗
███████╗██║     ██████╔╝█████╗██║██╔██║    ██╔╝╚██████║
╚════██║██║     ██╔═══╝ ╚════╝████╔╝██║   ██╔╝  ╚═══██║
███████║╚██████╗██║           ╚██████╔╝   ██║   █████╔╝
╚══════╝ ╚═════╝╚═╝            ╚═════╝    ╚═╝   ╚════╝ 
                                                       

Self Hosting Instructions

The construction of SCP-079 series bots involves the creation of multiple channels, groups, bot accounts, and user accounts. The following is a description of the channels, groups, and accounts needed to build a complete instance. Of course, you can build only one or a few bots according to the required functions, and you can create channels, groups, etc. by referring to the individual introduction pages of each bot.

The public channels required for a complete instance of this project are:

The private channels required for a complete instance of this project are:

The private groups required for a complete instance of this project are:

The usual bots required for a complete instance of this project are:

The user bots required for the complete instances of this project are:

Among them, SCP-079-USER is the core of all bots working in the group. They all require SCP-079-USER to assist in the group

Please refer to the separate introduction page of the corresponding bot for the specific requirements of the channel and group joining status of each bot. This article only takes the establishment of SCP-079-PM (private chat bot) as an example to introduce the general steps required to build a SCP-079 series bot.

The system environment used in this example is:

See also: The Reason Why You Should Host Your Own Bots


Upgrade the System

First, make sure the system environment is up to date, execute the following command:

sudo apt update
sudo apt full-upgrade -y
sudo apt autoremove -y

Install Basic Packages

Install vim, git and other tools:

sudo apt install build-essential git python3-dev python3-venv vim -y

Other Dependencies

Some projects require installation of additional packages. Be sure to check the description in each project’s individual page.

Create Virtual Environment

Bots can generally share the same virtual environment, and usually do not need to be created again.

Note: To use NOPORN or RECHECK, follow the commands given by its README.md or individual page.

mkdir ~/scp-079
python3 -m venv ~/scp-079/venv

Set the systemd Service

Except for the need to update units, there is no need to repeat cloning next time to build other bots:

mkdir -p ~/.config/systemd
git clone https://github.com/scp-079/units.git ~/.config/systemd/user

Set the scripts

Except for the need to update scripts, there is no need to repeat cloning next time to build other bots:

git clone https://github.com/scp-079/scripts.git ~/scp-079/scripts

Set Convenient Commands

The next time you build another robot, you don’t need to repeat the settings:

vim ~/.bash_aliases

Add the following:

alias scp-079="source ~/scp-079/venv/bin/activate"
alias config="bash ~/scp-079/scripts/config.sh"
alias log="bash ~/scp-079/scripts/log.sh"
alias restart="bash ~/scp-079/scripts/restart.sh"
alias status="bash ~/scp-079/scripts/status.sh"
alias start="bash ~/scp-079/scripts/start.sh"
alias stop="bash ~/scp-079/scripts/stop.sh"
alias update="bash ~/scp-079/scripts/update.sh"

Let it take effect:

source ~/.bash_aliases

Clone

For example, use SCP-079-PM and clone according to the separate instruction of the project:

git clone https://github.com/scp-079/scp-079-pm.git ~/scp-079/pm

Install Dependencies Using pip

scp-079    # Switch to virtual environment
pip install -r ~/scp-079/pm/requirements.txt
deactivate    # Exit the virtual environment

Modify Configuration File

Modify the project’s config.ini file as needed:

cp ~/scp-079/pm/config.ini.example ~/scp-079/pm/config.ini
config pm

You need to modify all the key values ​​in the config.ini file with the content [DATA EXPUNGED]. The meaning of the parameters in the config.ini file can be viewed in the separate instruction’s Document #config.ini.

Note: Some bots need to fill in the key value in [encrypt]. The entire project uses the same key. It needs to be generated by the program. Get the key as follows:

python3
from cryptography.fernet import Fernet
key = Fernet.generate_key()
print(key.decode())    # Then copy the printed key and fill it into the config.ini file

Additional Actions to Take

Some bots may require additional changes, such as changes to the environment, downloading required models, adding custom files, and more. Please refer to the description in the section of Appendix: Steps to Create a Bot On Your Own in individual introduction pages of each bot.


Enbale Services

For ordinary bots, such as SCP-079-PM in this article, services can be started directly:

bash ~/scp-079/scripts/enable.sh
start pm

For user bot with user account, you need to log in first (take SCP-079-USER as an example):

scp-079    # Switch to virtual environment
cd ~/scp-079/user
python main.py    # Start the program temporarily

At this time, you will be prompted to log in to the account, and you can do as required. Note that there is no space or symbol in the middle of the mobile phone number input, and the front plus sign is omitted. If the login is successful, press Ctrl + C to exit the program, and then start the service:

deactivate    # Exit the virtual environment
bash ~/scp-079/scripts/enable.sh
start user

Convenient Command Usage

Configure the bot:

config pm

View the bot log:

log pm

Restart the bot:

start pm

Stop the bot:

stop pm

Force the bot to restart:

restart pm

View the bot systemd service status:

status pm

Update the bot:

update pm