Running the bot

From Werewolf Wiki
Jump to navigation Jump to search

Prerequisites

To install lykos, you will need the following:

  • Python 3.9 or newer is required. When installing Python on Windows, ensure that you select "Add Python to PATH" on the installer screen.
  • The pip program to install Python packages is recommended. If you do not have it, you will need to download and install the dependencies yourself, which is not covered in this guide.
  • Installing Git is recommended. You cannot use various commands (such as !update) without Git.
  • Familiarity with IRC and the Operating System you are installing lykos on is required. You will need to be comfortable running things in a terminal/command line environment, and you will need to know core things about IRC such as what commands are used to authenticate with Services (if any) and what channel modes are. If this doesn't describe you, then we recommend that you do not run lykos.

Installing on Windows

Go to the folder you want to download your instance of lykos. Do not create a separate folder for it, Git will do that by itself. Right click and select "Git Bash Here" from the drop-down menu that appears. In the window that opens, type the following command and press enter. It may take some time, do not close the window or proceed onwards until you see a prompt again (a blinking cursor with a $ in front of it).

git clone https://github.com/lykoss/lykos

Once the above command is complete and you see the prompt again, Git has finished downloading the files and put them into a new folder called "lykos." Run the following commands, pressing enter after each one. The second command may take a while again. Once you finish running every command (the prompt appears again), you can close the window.

cd lykos
py -3 -m pip install -r requirements.txt

Installing on Linux

Open a terminal window and change directories to where you wish to install lykos, then run the following commands:

git clone https://github.com/lykoss/lykos
cd lykos
python3 -m pip install -r requirements.txt

Configuration

Main article: Configuration

At a minimum in order to run lykos, you will need to create a botconfig.yml file. We supply a botconfig.example.yml file that you should copy to your botconfig.yml to get a mostly-working configuration. You will need to further modify that file to include the server connection details and bot nickname and password. Depending on what IRC network you are connecting to, you may need to configure other things as well. For further assistance in configuring the bot, see the configuration article.

Important: Do not modify any files in the src or messages directories, it will make updating the bot significantly more difficult and you will be unable to receive official support for the bot! A great amount of customization can be made without needing to modify any of those files.

Updating

  • Option 1: While the bot is up and running, use the !update command to pull the latest code from the repository and restart the bot to update it.
  • Option 2: Open a terminal (Git Bash if you are on Windows) in the bot's directory and run git pull to fetch the latest code. The changes will automatically take effect the next time you start the bot.

Supported Networks

The IRC network needs to support accounts (e.g. via NickServ) and expose the account that a user is logged into in order for the bot to function. If your network doesn't support accounts, or doesn't expose account names, there is a workaround you can apply. However, improperly applying this workaround will lead to security risks such as people being able to execute code on the bot's server or take over the IRC channel.

The example below will set the account to the user's ident@host part of their hostmask. This is insecure if a network allows for spoofing hostmasks (e.g. HostServ or cavalier opers with /sethost). To install this example, create the file hooks/account.py with the following contents:

from src.events import Event, event_listener
from src.users import User

@event_listener("update_account_data")
def on_update_account_data(evt: Event, user: User):
    user.account = user.ident + "@" + user.host
    evt.prevent_default = True