Moved guides from readme to docs. Refactored docs

This commit is contained in:
Kwoth
2021-09-02 18:36:03 +02:00
parent 3fd8beaaf6
commit 2a8bb18e7c
15 changed files with 337 additions and 1081 deletions

View File

@@ -1,7 +1,3 @@
# Setting up NadekoBot with Docker
Hosting Nadeko with Docker is not officially supported until the next major version (3.0)
If you've been previously hosting with Docker, please move to one of the other hosting options.
You may ask for guidance on our [discord server.][discord-server]
[discord-server]: https://discord.nadeko.bot
Soon:tm:

View File

@@ -1,168 +0,0 @@
## Setting up NadekoBot From Source
| Table of Contents |
| :-------------------------------------------------------------------------------------------------------------------------------------- |
| [Installing with the CLI Installer](#installing-with-the-cli-installer) |
| [Setup (CLI)](#setup-cli) |
| [Launching Nadeko (CLI)](#launching-nadeko-cli) |
| [Installing Nadeko Manually](#installing-nadeko-manually) |
| [Setup](#setup) |
| [Launching Nadeko](#launching-nadeko) |
| [Updating Nadeko](#updating-nadeko) |
### Installing with the CLI Installer
This is the recommended way of installing Nadeko from source. If you don't want to use the installer, skip to [Installing Nadeko Manually](#installing-nadeko-manually).
#### Prerequisites (CLI)
- Windows 7 or later
- If you are on Windows 7, you must update [PowerShell].
- [.net5 SDK][.net] (restart Windows after installation)
- [Git] (select [this option](https://i.imgur.com/zlWVTsi.png) during the installation process)
- Redis
- Windows 64 bit: Download and install the [latest msi][Redis]. Don't forget to [add it to the path environment variable](https://i.imgur.com/uUby6Xw.png) during the installation process.
- Windows 32 bit: Skip this step
- [Create a Discord Bot application](../../create-invite/#creating-discord-bot-application) and [invite the bot to your server](../../create-invite/#inviting-your-bot-to-your-server).
**Optional**
If you want Nadeko to play music, do the following:
- Install [Visual C++ 2010 (x86)] and [Visual C++ 2017] (both are required - restart Windows after installation)
- [youtube-dl] - Click on `Windows.exe` (on the top left corner) and download the file. Then move it to **`C:\youtube-dl`**. If the folder `youtube-dl` doesn't exist, create one.
#### Setup (CLI)
- Download the [CLI installer](https://cdn.discordapp.com/attachments/287982972664020994/416782797420888074/NadekoInstaller.zip). Move it to where you want Nadeko's files to be.
- Right click the file and extract it.
- Right click the **`NadekoInstaller.bat`** file and open it as Administrator.
- After the admin check, you should see main menu with the options below:
```
1. Download Latest Build
2. Run NadekoBot (normally)
3. Run NadekoBot with Auto Restart (check "if" nadeko is working properly, before using this)
4. Setup credentials.json
5. Install ffmpeg (for music)
6. Redis Installation (Opens Website) (64bit)
7. Run Redis (if its not running) (64bit)
8. Install Youtube-dl. (Opens Website)
9. Add Youtube-dl to PATH.
10. Add Redis to PATH. (Advanced Users Only) ("Run Redis" is enough for Normal Users.) (64bit)
11. Install .NET Core SDK (Opens Website)
12. Install Git. (Opens Website)
13. Copy libsodium and opus dll files for 32bit users. (Required for 32bit, Music)
14. Download and run redis-server for 32bit users. (32bit)
15. [NEW] NadekoBot Extensions
16. To exit
```
- Run Option `1` to download Nadeko (type 1 and press Enter). Once it's done, it should take you back to the main menu.
- Run Option `4` to [set up your credentials](../../jsons-explained). Paste the info as requested.
- **If your Windows is 32-bit**, run Option `14` now. Otherwise, ignore this step.
- Nadeko should be ready to launch. Run Option `2` to test it out. If everything goes well, Nadeko should appear as online on your Discord server and respond to commands. Once you're done with testing, type **`.die`** to shut it down and return to the installer's main menu.
If you don't want the music features, you can launch Nadeko with Option `3` and have fun with your newly created bot. Otherwise, follow the steps below.
- If you haven't downloaded **`youtube-dl.exe`** and moved it to **`C:\youtube-dl`** yet, then do it now.
- **If your Windows is 32-bit**, run Option `13`. Otherwise, ignore this step.
- Run Option `5` to download **`ffmpeg`**.
- Run Option `9` to add **`youtube-dl.exe`** to your system's path environment variable.
- That's it. You're done. Launch Nadeko with Option `3` and have fun sharing music with your friends.
#### Launching Nadeko (CLI)
- Just open the CLI installer and run Option `2` or `3`. Easy as that.
---
### Installing Nadeko Manually
This is the *"hard"* way of installing Nadeko. If you're here, we are assuming you know what the hell you're doing.
#### Prerequisites
- Windows 7 or later
- [.net5 SDK][.net] (restart Windows after installation)
- [Git] (select [this option](https://i.imgur.com/zlWVTsi.png) during the installation process)
- Redis
- Windows 64 bit: Download and install the [latest msi][Redis]. Don't forget to [add it to the path environment variable](https://i.imgur.com/uUby6Xw.png) during the installation process.
- Windows 32 bit: Download [redis-server.exe](https://github.com/MaybeGoogle/NadekoFiles/blob/master/x86%20Prereqs/redis-server.exe?raw=true) and store it somewhere accessible.
- [Create a Discord Bot application](../../jsons-explained/#creating-discord-bot-application) and [invite the bot to your server](../../jsons-explained/#inviting-your-bot-to-your-server).
**Optional**
If you want Nadeko to play music, do the following:
- [Notepad++] (makes it easier to edit your credentials)
- Install [Visual C++ 2010 (x86)] and [Visual C++ 2017] (both are required - restart Windows after installation)
- [youtube-dl] - Click on `Windows.exe` (on the top left corner) and download the file. Store it somewhere accessible.
- [ffmpeg-32bit] / [ffmpeg-64bit] - Download the version for your architecture. Extract it, then find and copy the `ffmpeg.exe` file to somewhere accessible.
- **For 32-bit Windows**, download [libsodium](https://github.com/MaybeGoogle/NadekoFiles/blob/master/x86%20Prereqs/NadekoBot_Music/libsodium.dll?raw=true) and (lib)[opus](https://github.com/MaybeGoogle/NadekoFiles/blob/master/x86%20Prereqs/NadekoBot_Music/opus.dll?raw=true) and store them somewhere accessible.
#### Setup
- Open command prompt (`cmd.exe`) and run the following command to download the source:
- `git clone -b 1.9 https://gitlab.com/Kwoth/NadekoBot`
- On Windows Explorer, go to `NadekoBot/src/NadekoBot` and edit the `credentials.json` file according to this [guide](../../jsons-explained/#setting-up-credentialsjson-file).
- Add these 2 arguments to your credentials file:
```js
"ShardRunCommand": "dotnet",
"ShardRunArguments": "run -c Release --no-build -- {0} {1}",
```
- Move **`youtube-dl.exe`** and **`ffmpeg.exe`** into `NadekoBot/src/NadekoBot` (or add them to your PATH environment variable, if you know how)
- **For 32-bit Windows**, replace **`libsodium.dll`** and **`opus.dll`** in `NadekoBot/src/NadekoBot` with the ones you've downloaded.
#### Launching Nadeko
- **For 32-bit Windows**, run the **`redis-server.exe`** you have downloaded. You **must** have this window open while using NadekoBot.
- On command prompt, move to the correct directory:
- `cd NadekoBot/src/NadekoBot`
- Build and run Nadeko:
- `dotnet run -c Release`
- If everything goes well, Nadeko should start up and show as online in your Discord server.
---
### Updating Nadeko
**If you have not made custom edits to the source code.**
- If you're using the CLI installer, shut your bot down and run Option `1`. That's it.
- If you've installed manually, open command prompt (`cmd.exe`)
- Move to Nadeko's root folder:
- `cd NadekoBot`
- Update Nadeko:
- `git pull`
**If you have made custom edits to the source code.**
- Open command prompt (`cmd.exe`)
- Move to Nadeko's root folder:
- `cd NadekoBot`
- Stash your changes:
- `git stash save "give me a nice name dd-mm-yyyy"` or just `git stash`
- Update Nadeko:
- `git pull`
- Apply your stash:
- `git stash apply` or `git stash apply stash@{n}` (where `n` is the ID of the stash)
Other useful commands:
- `git status` to check the changes you've made
- `git stash list` to see the list of saved stashes and their corresponding ID
- `git stash drop stash@{n}` to delete a specific stash
- `git stash pop stash@{n}` to apply and delete a specific stash
[Notepad++]: https://notepad-plus-plus.org/
[PowerShell]: https://www.microsoft.com/en-us/download/details.aspx?id=54616
[.net]: https://dotnet.microsoft.com/download/dotnet/5.0
[Redis]: https://github.com/MicrosoftArchive/redis/releases/tag/win-3.0.504
[Git]: https://git-scm.com/downloads
[Visual C++ 2010 (x86)]: https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe
[Visual C++ 2017]: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
[ffmpeg-32bit]: https://cdn.nadeko.bot/dl/ffmpeg-32.zip
[ffmpeg-64bit]: https://cdn.nadeko.bot/dl/ffmpeg-64.zip
[youtube-dl]: https://rg3.github.io/youtube-dl/download.html

View File

@@ -1,275 +1,101 @@
## Setting up NadekoBot on Linux
| Table of Contents |
| :-------------------------------------------------- |
| [Getting Started] |
| [Downloading and Installing the Prerequisites] |
| [Installing Nadeko] |
| [Setting up, Running and Updating Nadeko with pm2] |
| [Running Nadeko on tmux] |
| [Making Nadeko persist upon system restarts (tmux)] |
| [Setting up Nadeko on a VPS (Digital Ocean)] |
#### Operating System Compatibility
It is recommended that you use **Ubuntu 16.04**, as there have been nearly no problems with it. Music features are currently not working on Debian and CentOS. Also, **32-bit systems are incompatible**.
##### Compatible operating systems:
- Ubuntu: 16.04, 18.04, 20.04
- Mint: 17, 18
- Debian: 9, 10
- CentOS: 7, 8
#### Getting Started
- Use the following command to get and run the **`linuxAIO.sh`** installer
- (PS: **Do Not** rename the **`linuxAIO.sh`** file)
`cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
You should see the main menu with the following options:
```
1. Download NadekoBot
2. Run Nadeko (Normally)
3. Run Nadeko with Auto Restart (Run Nadeko normally before using this.)
4. Auto-Install Prerequisites (For Ubuntu, Debian and CentOS)
5. Set up credentials.json (If you have downloaded NadekoBot already)
6. Set up pm2 for NadekoBot (see README)
7. Start Nadeko in pm2 (complete option 6 first)
8. Exit
```
#### Downloading and Installing the Prerequisites
- **If** you are running NadekoBot for the first time on your system and never had any *prerequisites* installed, press `4` and `enter` key, then `y` once you see the following:
```
Welcome to NadekoBot Auto Prerequisites Installer.
Would you like to continue?
```
- This will install all prerequisites your system needs in order to run NadekoBot.
- (Optional) **If** you prefer to install them manually, you can try finding them [here](https://github.com/Kwoth/NadekoBot-BashScript/blob/1.9/nadekoautoinstaller.sh).
Once it finishes, the installer should automatically take you back to the main menu.
#### Installing Nadeko
- Choose Option `1` to get the **most updated build of NadekoBot**. When the installation is complete, you will see the options again.
- If you haven't [set up your Discord bot application](../../create-invite/#creating-discord-bot-application) and [invited the bot to your server](../../create-invite/#inviting-your-bot-to-your-server) yet, do it now.
- Only the ClientID, Bot Token and OwnerID are required. Everything else is optional.
- The Google API Key is required if you want Nadeko to play music.
- Once you have acquired them, choose Option `5` to set up your credentials.
- You will be asked to enter your credentials. Just follow the on-screen instructions and enter them as requested. (*i.e.* If you are asked to insert the **Bot's Token**, then just copy and paste the **Bot's Token** and hit `Enter`. Rinse and repeat until it's over.)
- If you want to skip any optional information, just press `Enter` without typing/pasting anything.
Once you're done with the credentials, you should be taken back to the main menu.
##### Checking if Nadeko is working
- Choose Option `2` to **Run Nadeko (Normally)**.
- Check in your Discord server if your new bot is working properly. Once you're done testing, type `.die` to shut it down and return to the main menu.
You can now choose Option `3` and have Nadeko run with auto restart. It will work just fine, however it's strongly advised that you use Nadeko with a process manager like pm2 or tmux, as they will keep Nadeko running in the background, freeing up your terminal for other tasks.
---
#### Setting up, Running and Updating Nadeko with [pm2](https://github.com/Unitech/pm2/blob/master/README.md) [strongly recommended]
Nadeko can be run using [pm2](https://github.com/Unitech/pm2), a process manager that seamlessly handles keeping your bot up. Besides, it handles disconnections and shutdowns gracefully, ensuring any leftover processes are properly killed. It also persists on server restart, so you can restart your server or computer and pm2 will manage the startup of your bot. Lastly, there is proper error logging and overall logging. These are just a few features of pm2, and it is a great way to run Nadeko with stability.
##### Setting up pm2/NodeJS for Nadeko
**Before proceeding, make sure your bot is not running by either running `.die` in your Discord server or exiting the process with `Ctrl+C`.**
You may be presented with the installer main menu once you shut your bot down. If not, simply run `bash linuxAIO.sh`.
- Run Option `6` to install NodeJS and pm2.
- If you already have NodeJS and pm2 installed on your system, you can skip this step (which is a one-time thing).
- There is an automated script built in the installer so installation and startup is a breeze. Just select Option `7` to bring you to a menu of choices. These are the normal choices you have for running Nadeko.
```
[1] Start with auto-restart with .die and no auto-update.
[2] Start with auto-restart with .die and auto-update on restart as well.
[3] Run normally without any auto-restart or auto-update functionality.
```
- Simply choose one of these and Nadeko will start in pm2! If you did everything correctly, you can run the following to check your Nadeko setup:
`sudo pm2 status` to see all pm2 processes
`sudo pm2 info Nadeko` information about Nadeko
`sudo pm2 logs Nadeko` to view real-time logs of Nadeko, or
`sudo pm2 logs Nadeko --lines number` (**number** = how many lines you wish to output) to see a specific amount of lines of the log. The logfile is also stored and presented at the top of these commands
##### Updating Nadeko with pm2
- If you have set up Nadeko with auto-update, simply run `.die` on your Discord server. That's it!
- If you have set up Nadeko with **no** auto-update:
- Shut your bot down with `sudo pm2 stop Nadeko`
- Open the installer with `bash linuxAIO.sh` and choose Option `1`
- Once it's done, exit the installer with Option `8` and run `sudo pm2 restart Nadeko`
- You can watch your bot going online with `sudo pm2 logs Nadeko`
---
#### Running Nadeko on tmux [if you don't want to use pm2]
**Before proceeding, make sure your bot is not running by either running `.die` in your Discord server or exiting the process with `Ctrl+C`.**
If you are presented with the installer main menu, exit it by choosing Option `8`.
- Create a new session: `tmux new -s nadeko`
The above command will create a new session named **nadeko** *(you can replace “nadeko” with anything you prefer, it's your session name)*.
- Run the installer: `bash linuxAIO.sh`
- Choose `2` to **Run NadekoBot normally.**
- **NOTE**: With this option, if you use `.die` in Discord, the bot will shut down and stay offline until you manually run it again.
- Choose `3` to **Run NadekoBot with Auto Restart.**
- **NOTE**: With this option, the bot will auto run if you use `.die`, making it to function as restart.
You will be shown the following options:
```
1. Run Auto Restart normally without Updating.
2. Run Auto Restart and update NadekoBot.
3. Exit
```
- With option `1. Run Auto Restart normally without Updating`, the bot will restart on `.die` command and will not download the latest build available.
- With option `2. Run Auto Restart and update NadekoBot`, the bot will restart and download the latest build available everytime the `.die` command is used.
**Now check your Discord server, the bot should be online**
- To move the bot to the background, press **Ctrl+B**, release the keys then hit **D**. That will detach the session, allowing you to finally close the terminal window and not worry about having your bot shut down in the process.
#### Updating Nadeko
- If you're running Nadeko with auto-update, just type `.die` in your Discord server. That's it!
- If you're running Nadeko with **no** auto-update:
- Kill your previous session.
- Check the session name with `tmux ls`
- Kill with `tmux kill-session -t nadeko` (don't forget to replace "nadeko" with whatever you named your bot's session).
- Create a new session: `tmux new -s nadeko`
- Run this command: `cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
- Choose Option `1` to download the most up to date version of Nadeko.
- Once it's done, choose Option `2` or `3` and detach the session by pressing **Ctrl+B**, release then **D**.
#### Additional Information
- If you want to **see the active sessions**, run `tmux ls`. That will give you the list of the currently running sessions.
- If you want to **switch to/see a specific session**, type `tmux a -t nadeko` (**nadeko** is the name of the session we created before so, replace **“nadeko”** with the session name you have created).
- If you want to go through the log, press **Ctrl+B**, release the keys then hit **Page Up** or **Page Down** to navigate.
- Don't forget to always detach from the session by pressing **Ctrl+B** then **D** once you're done.
- If you want **create** a new session, run `tmux new -s nadeko`. If you want to **kill it**, run `tmux kill-session -t nadeko`
#### Making Nadeko persist upon system restarts (tmux - For Advanced Users)
This procedure is completely optional. We'll be using [*systemd*](https://en.wikipedia.org/wiki/Systemd) to handle Nadeko during system shutdowns and reboots.
**1.** Start off by downloading the necessary scripts:
- `cd ~ && wget https://raw.githubusercontent.com/Kaoticz/NadekoBot-BashScript/1.9k/nadeko.service`
- `cd ~ && wget https://raw.githubusercontent.com/Kwoth/NadekoBot-BashScript/1.9/NadekoARN.sh`
- `cd ~ && wget https://raw.githubusercontent.com/Kwoth/NadekoBot-BashScript/1.9/NadekoARU_Latest.sh`
**2.** If you **are** logged in as `root` and **don't want** Nadeko to auto-update, ignore the procedures below and go straight to step 3.
---
- Let's edit the script *systemd* is going to use to start Nadeko: `nano nadeko.service`
- You should see the following:
```css
[Unit]
Description=NadekoBot
[Service]
WorkingDirectory=/root
User=root
Type=forking
ExecStart=/usr/bin/tmux new-session -s Nadeko -d '/bin/sh NadekoARN.sh'
ExecStop=/bin/sleep 2
[Install]
WantedBy=multi-user.target
```
- Change `/root` from *"WorkingDirectory"* to the directory that contains your NadekoBot folder.
- For example, if your bot is located in `/home/username/NadekoBot`, you should change `/root` to `/home/username`.
- Change `root` from *"User"* to whatever username you're using.
- **Optional:** If you want Nadeko to auto-update upon restarts, change `NadekoARN.sh` to `NadekoARU_Latest.sh`.
- Once you're done, press `Ctrl+X` to exit nano, type `y` to confirm the changes and `Enter` to go back to the terminal.
---
**3.** Now the script needs to be moved to where *systemd* stores their services. On Ubuntu, it's usually in `/etc/systemd/system`. If you are not using Ubuntu and are unsure about where *systemd* stores stuff, [Google is your best friend](https://www.google.com/ "MaybeGoogle :^)").
- To do that, run this command: `sudo mv nadeko.service /etc/systemd/system/nadeko.service`
**4.** Now it's time to reload *systemd*, so it loads our new script up: `sudo systemctl daemon-reload`
**5.** Set the script to run upon system restarts: `sudo systemctl enable nadeko`
**6.** Start Nadeko on the current session: `sudo systemctl start nadeko`
And that's it. Every time your system restarts, *systemd* should automatically startup your bot with tmux. If everything has gone well, you should be able to see Nadeko on the list of processes being handled by tmux by running the `tmux ls` command.
#### Managing Nadeko on tmux with systemd
Here is a list of useful commands if you intend on managing Nadeko with *systemd*.
- `tmux ls` - lists all processes managed by tmux.
- `tmux a -t Nadeko` - shows Nadeko's log (press `Ctrl+B` then `D` to exit).
- `sudo systemctl start nadeko` - starts Nadeko, if it has been stoped.
- `sudo systemctl restart nadeko` - restarts Nadeko. Can be used while the bot is being run.
- `sudo systemctl stop nadeko` - completely shuts Nadeko down.
- `sudo systemctl enable nadeko` - makes Nadeko start automatically upon system reboots.
- `sudo systemctl disable nadeko` - stops Nadeko from starting automatically upon system reboots.
- `sudo systemctl status nadeko` - shows some information about your bot (press `Ctrl+C` to exit).
---
### Setting up Nadeko on a Linux VPS (Digital Ocean Droplet)
If you want Nadeko to play music for you 24/7 without having to hosting it on your PC and want to keep it cheap, reliable and convenient as possible, you can try Nadeko on Linux Digital Ocean Droplet using the link [DigitalOcean](http://m.do.co/c/46b4d3d44795/) (by using this link, you will get **$10 credit** and also support Nadeko)
**Setting up NadekoBot**
Assuming you have followed the link above to setup an account and a Droplet with a 64-bit operational system on Digital Ocean and got the `IP address and root password (in your e-mail)` to login, it's time to get started.
**This section is only relevant to those who want to host Nadeko on DigitalOcean. Go through this whole section before setting the bot up.**
#### Prerequisites
- Download [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
- Download [WinSCP](https://winscp.net/eng/download.php) *(optional)*
- [Create and invite the bot](../../jsons-explained/#creating-discord-bot-application).
#### Starting up
- **Open PuTTY** and paste or enter your `IP address` and then click **Open**.
If you entered your Droplets IP address correctly, it should show **login as:** in a newly opened window.
- Now for **login as:**, type `root` and press enter.
- It should then ask for a password. Type the `root password` you have received in your e-mail address, then press Enter.
If you are running your droplet for the first time, it will most likely ask you to change your root password. To do that, copy the **password you've received by e-mail** and paste it on PuTTY.
- To paste, just right-click the window (it won't show any changes on the screen), then press Enter.
- Type a **new password** somewhere, copy and paste it on PuTTY. Press Enter then paste it again.
**Save the new password somewhere safe.**
After that, your droplet should be ready for use. [Follow the guide from the beginning](#getting-started) to set Nadeko up on your newly created VPS.
[Getting Started]: #getting-started
[Downloading and Installing the Prerequisites]: #downloading-and-installing-the-prerequisites
[Installing Nadeko]: #installing-nadeko
[Setting up, Running and Updating Nadeko with pm2]: #setting-up-running-and-updating-nadeko-with-pm2-strongly-recommended
[Running Nadeko on tmux]: #running-nadeko-on-tmux-if-you-dont-want-to-use-pm2
[Making Nadeko persist upon system restarts (tmux)]: #making-nadeko-persist-upon-system-restarts-tmux-for-advanced-users
[Setting up Nadeko on a VPS (Digital Ocean)]: #setting-up-nadeko-on-a-linux-vps-digital-ocean-droplet
## Migration from 2.x
⚠ If you're already hosting NadekoBot, You **MUST** update to latest version of 2.x and **run your bot at least once** before switching over to v3.
#### [Linux migration instructions](migration-instructions#linux)
## Linux From Source
Open Terminal (if you're on an installation with a window manager) and navigate to the location where you want to install the bot (for example `cd ~`)
##### Installation Instructions
1. Download and run the **new** installer script `cd ~ && wget -N https://gitlab.com/Kwoth/nadeko-bash-installer/-/raw/master/linuxAIO.sh && bash linuxAIO.sh`
2. Install prerequisites (type `1` and press enter)
3. Download the bot (type `2` and press enter)
4. Exit the installer in order to set up your `creds.yml`
5. Copy the creds.yml template `cp nadekobot/output/creds_example.yml nadekobot/output/creds.yml`
6. Open `nadekobot/output/creds.yml` with your favorite text editor. We will use nano here
- `nano nadekobot/output/creds.yml`
7. [Enter your bot's token](#creds-guide)
- After you're done, you can close nano (and save the file) by inputting, in order
- `CTRL`+`X`
- `Y`
- `Enter`
8. Run the bot (type `3` and press enter)
##### Update Instructions
1. ⚠ Stop the bot
2. Update and run the **new** installer script `cd ~ && wget -N https://gitlab.com/Kwoth/nadeko-bash-installer/-/raw/master/linuxAIO.sh && bash linuxAIO.sh`
3. Update the bot (type `2` and press enter)
4. Run the bot (type `3` and press enter)
5. 🎉
## Linux Release
##### Installation Instructions
1. Download the latest release from <https://gitlab.com/Kwoth/nadekobot/-/releases>
- Look for the file called "X.XX.X-linux-x64-build.tar" (where X.XX.X is a series of numbers) and download it
2. Untar it
⚠ Make sure that you change X.XX.X to the same series of numbers as in step 1!
- `tar xf X.XX.X-linux-x64-build.tar`
3. Rename the `nadekobot-linux-x64` to `nadekobot`
- `mv nadekobot-linux-x64 nadekobot`
4. Move into nadekobot directory and make NadekoBot executable
- `cd nadekobot && chmod +x NadekoBot`
5. Copy the creds.yml template
- `cp creds_example.yml creds.yml`
6. Open `creds.yml` with your favorite text editor. We will use nano here
- `nano nadekobot/output/creds.yml`
8. [Enter your bot's token](#creds-guide)
- After you're done, you can close nano (and save the file) by inputting, in order
- `CTRL`+`X`
- `Y`
- `Enter`
9. Run the bot
- `./NadekoBot`
##### Update Instructions
1. Stop the bot
2. Download the latest release from <https://gitlab.com/Kwoth/nadekobot/-/releases>
- Look for the file called "X.XX.X-linux-x64-build.tar" (where X.XX.X is a series of numbers) and download it
3. Untar it
⚠ Make sure that you change X.XX.X to the same series of numbers as in step 2!
- `tar xf 2.99.8-linux-x64-build.tar`
4. Rename the old nadekobot directory to nadekobot-old (remove your old backup first if you have one, or back it up under a different name)
- `rm -rf nadekobot-old 2>/dev/null`
- `mv nadekobot nadekobot-old`
5. Rename the new nadekobot directory to nadekobot
- `mv nadekobot-linux-x64 nadekobot`
6. Remove old strings and aliases to avoid overwriting the updated versions of those files
⚠ If you've modified said files, back them up instead
- `rm nadekobot-old/data/aliases.yml`
- `rm -r nadekobot-old/data/strings`
7. Copy old data
- `cp -RT nadekobot-old/data/ nadekobot/data/`
8. Copy creds.yml
- `cp nadekobot-old/creds.yml nadekobot/`
9. Move into nadekobot directory and make the NadekoBot executable
- `cd nadekobot && chmod +x NadekoBot`
10. Run the bot
- `./NadekoBot`
🎉 Enjoy
##### Steps 3 - 9 as a single command
Don't forget to change X.XX.X to match step 2.
```sh
tar xf X.XX.X-linux-x64-build.tar && \
rm -rf nadekobot-old 2>/dev/null && \
mv nadekobot nadekobot-old && \
mv nadekobot-linux-x64 nadekobot && \
rm nadekobot-old/data/aliases.yml && \
rm -r nadekobot-old/data/strings && \
cp -RT nadekobot-old/data/ nadekobot/data/ && \
cp nadekobot-old/creds.yml nadekobot/ && \
cd nadekobot && chmod +x NadekoBot
```

View File

@@ -0,0 +1,61 @@
# Migration instructions (2.x to v3)
## Windows
1. Run your NadekoBot Updater first, and **make sure your bot is updated to at least 2.46.5**
2. Get the new NadekoBot v3 Updater [here](https://dl.nadeko.bot/v3)
3. Click on the + icon to add a new bot
4. Next to the path, click on the folder icon and select the folder where your 2.46.5 bot is
- In case you're not sure where it's located, you can open your old updater and see it
5. If you've selected the correct path, you should have an **Update** button available, click it
6. You're done; you can now run your bot, and you can uninstall your old updater if you no longer have 2.x bots
7. 🎉
## Linux
1. In order to migrate a bot hosted on **Linux**, first update your current version to the latest 2.x version using the 2.x installer, run the bot, and make sure it works. Then:
- Run the **old** installer with `cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
- Run option **1** again
- Run the bot
- Type `.stats` and ensure the version is `2.46.5` or later
- Stop the bot
2. Make sure your bot's folder is called `NadekoBot`
- Run `cd ~ && ls`
- Confirm there is a folder NadekoBot
3. Migrate your bot's data using the new installer:
- Run the **new** installer `cd ~ && wget -N https://gitlab.com/Kwoth/nadeko-bash-installer/-/raw/master/linuxAIO.sh && bash linuxAIO.sh`
- The installer should notify you that your data is ready for migration in a message above the menu
- Install prerequisites (type `1` and press enter), and make sure it is successful
- Download NadekoBot v3 (type `2` and press enter)
- Run the bot (type `3` and press enter)
4. Make sure your permissions, custom reactions, credentials, and other data is preserved
- `.stats` to ensure owner id (credentials) is correct
- `.lcr` to see custom reactions
- `.lp` to list permissions
5. 🎉 Enjoy. If you want to learn how to update the bot, click (here)[#linux-updating-the-bot].
## Manual
⚠ NOT RECOMMENDED
⚠ NadekoBot v3 requires [.net 5](https://dotnet.microsoft.com/download/dotnet/5.0)
1. In order to migrate a bot hosted **on Linux or from source on Windows**, first update your current version to the latest 2.x version using the 2.x installer, run the bot, and make sure it works. Then:
2. Rename your old nadeko bot folder to `nadekobot_2x`
- `mv NadekoBot nadekobot_2x`
3. Build the new version and move old data to the output folder
1. Clone the v3 branch to a separate folder
- `git clone https://gitlab.com/kwoth/nadekobot -b v3 --depth 1`
2. Build the bot
- `dotnet publish -c Release -o output/ src/NadekoBot/`
3. Copy old data
- ⚠ Be sure you copy the correct command for your system!
- **Windows:** `cp -r -fo nadekobot_2x/src/NadekoBot/data nadekobot/src/NadekoBot/data`
- **Linux:** `cp -rf nadekobot_2x/src/NadekoBot/data nadekobot/src/NadekoBot/data`
4. Copy the database
- `cp nadekobot_2x/src/NadekoBot/bin/Release/netcoreapp2.1/data/NadekoBot.db nadekobot/output/data`
5. Copy your credentials
- `cp nadekobot_2x/src/NadekoBot/credentials.json nadekobot/output/`
4. Run the bot
- `cd nadekobot/output`
- `dotnet NadekoBot.dll`
5. That's it. Just make sure that when you're updating the bot, you're properly backing up your old data.

View File

@@ -1,175 +1,95 @@
## Setting Up NadekoBot on OSX (macOS)
### Linux From Source
| Table of Contents |
| :------------------------------------------------------ |
| [Prerequisites] |
| [Installing Homebrew] |
| [Downloading and Running Nadeko] |
| [Running Nadeko with the Terminal closed] |
| [Using Nadeko with pm2 (easiest method)] |
| [Using Nadeko with tmux (if you don't want to use pm2)] |
| [Doing a clean reinstall] |
Open Terminal (if you're on an installation with a window manager) and navigate to the location where you want to install the bot (for example `cd ~`)
#### Prerequisites
##### Installation Instructions
- OSX 10.12 (Sierra) or higher (needed for .NET Core 2.x).
- [Homebrew](http://brew.sh/).
- [Create a Discord Bot application](../../create-invite/#creating-discord-bot-application) and [invite the bot to your server](../../create-invite/#inviting-your-bot-to-your-server).
#### Installing Homebrew
1. Download and run the **new** installer script `cd ~ && wget -N https://gitlab.com/Kwoth/nadeko-bash-installer/-/raw/master/linuxAIO.sh && bash linuxAIO.sh`
2. Install prerequisites (type `1` and press enter)
3. Download the bot (type `2` and press enter)
4. Exit the installer in order to set up your `creds.yml`
5. Copy the creds.yml template `cp nadekobot/output/creds_example.yml nadekobot/output/creds.yml`
6. Open `nadekobot/output/creds.yml` with your favorite text editor. We will use nano here
- `nano nadekobot/output/creds.yml`
7. [Enter your bot's token](#creds-guide)
- After you're done, you can close nano (and save the file) by inputting, in order
- `CTRL`+`X`
- `Y`
- `Enter`
8. Run the bot (type `3` and press enter)
- Open Terminal (if you don't know how to, click on the magnifying glass on the top right corner of your screen and type **Terminal** on the window that pops up).
- Copy and paste this command, then press Enter:
`/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
##### Update Instructions
1. ⚠ Stop the bot
2. Update and run the **new** installer script `cd ~ && wget -N https://gitlab.com/Kwoth/nadeko-bash-installer/-/raw/master/linuxAIO.sh && bash linuxAIO.sh`
3. Update the bot (type `2` and press enter)
4. Run the bot (type `3` and press enter)
5. 🎉
#### Installing the prerequisites
### Linux Release
Run this command in Terminal (copy-paste the entire block):
##### Installation Instructions
``` bash
brew install wget git ffmpeg openssl opus opus-tools opusfile libffi libsodium tmux python youtube-dl redis npm
1. Download the latest release from <https://gitlab.com/Kwoth/nadekobot/-/releases>
- Look for the file called "X.XX.X-linux-x64-build.tar" (where X.XX.X is a series of numbers) and download it
2. Untar it
⚠ Make sure that you change X.XX.X to the same series of numbers as in step 1!
- `tar xf X.XX.X-linux-x64-build.tar`
3. Rename the `nadekobot-linux-x64` to `nadekobot`
- `mv nadekobot-linux-x64 nadekobot`
4. Move into nadekobot directory and make NadekoBot executable
- `cd nadekobot && chmod +x NadekoBot`
5. Copy the creds.yml template
- `cp creds_example.yml creds.yml`
6. Open `creds.yml` with your favorite text editor. We will use nano here
- `nano nadekobot/output/creds.yml`
8. [Enter your bot's token](#creds-guide)
- After you're done, you can close nano (and save the file) by inputting, in order
- `CTRL`+`X`
- `Y`
- `Enter`
9. Run the bot
- `./NadekoBot`
brew services start redis
##### Update Instructions
npm install pm2@3.1.3 -g
```
1. Stop the bot
2. Download the latest release from <https://gitlab.com/Kwoth/nadekobot/-/releases>
- Look for the file called "X.XX.X-linux-x64-build.tar" (where X.XX.X is a series of numbers) and download it
3. Untar it
⚠ Make sure that you change X.XX.X to the same series of numbers as in step 2!
- `tar xf 2.99.8-linux-x64-build.tar`
4. Rename the old nadekobot directory to nadekobot-old (remove your old backup first if you have one, or back it up under a different name)
- `rm -rf nadekobot-old 2>/dev/null`
- `mv nadekobot nadekobot-old`
5. Rename the new nadekobot directory to nadekobot
- `mv nadekobot-linux-x64 nadekobot`
6. Remove old strings and aliases to avoid overwriting the updated versions of those files
⚠ If you've modified said files, back them up instead
- `rm nadekobot-old/data/aliases.yml`
- `rm -r nadekobot-old/data/strings`
7. Copy old data
- `cp -RT nadekobot-old/data/ nadekobot/data/`
8. Copy creds.yml
- `cp nadekobot-old/creds.yml nadekobot/`
9. Move into nadekobot directory and make the NadekoBot executable
- `cd nadekobot && chmod +x NadekoBot`
10. Run the bot
- `./NadekoBot`
**Installing .net SDK**
🎉 Enjoy
- Download [.net5 SDK](https://dotnet.microsoft.com/download/dotnet/5.0)
- Open the `.pkg` file you've downloaded and install it.
- Run this command in Terminal. There might be output. If there is, disregard it. (copy-paste the entire block)
```bash
sudo mkdir /usr/local/bin
##### Steps 3 - 9 as a single command
sudo mkdir /usr/local/lib
```
- Run this command in Terminal. There won't be any output. (copy-paste the entire block):
```bash
sudo ln -s /usr/local/share/dotnet/dotnet /usr/local/bin
sudo ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
sudo ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
```
#### Downloading and Running Nadeko
- Use the following command to download and run the installer. (PS: **Do not** rename the **`linuxAIO.sh`** file)
`cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
- Choose Option `1` to download Nadeko. Once installation is completed you should see the options again.
- Choose Option `5` to set up your credentials according to this [guide](../../jsons-explained/#setting-up-credentialsjson-file), or find and edit the `credentials.json` file manually.
- Choose Option `2` to **Run Nadeko (Normally)**.
- Check in your Discord server if your new bot is working properly. Once you're done testing, type `.die` on Discord to shut it down. The Terminal should automatically return to the main menu.
#### Running NadekoBot with the terminal closed
If you run Nadeko through option 2 or 3 and close the terminal, Nadeko will also close. To avoid this, you'll need to use a process manager that will keep it open and running in the background. This section of the guide instructs on how to achieve this with pm2 and tmux. Whether you pick one or the other, please **do not** simultaneously, or you're going to get double responses to every command.
#### Using Nadeko with pm2 (easiest method)
- pm2 will not only allow Nadeko to run in the background, but will also automatically launch Nadeko upon system reboots.
- Open the installer, if you haven't already:
`cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
- Run Option `7` (ignore Option `6`, that's for Linux only).
- Pick whether you want to run it with or without auto-restart and auto-update.
- Once it's done, run Option `8` to exit.
- That's it. Your bot should be running in the background. Feel free to close the Terminal window.
**Managing Nadeko with pm2**
- Use the following commands on Terminal to check your Nadeko setup:
- `pm2 status` to see all pm2 processes
- `pm2 info Nadeko` to see information about Nadeko
- `pm2 logs Nadeko` to view real-time logs of Nadeko, or
- `pm2 logs Nadeko --lines number` (**number** = how many lines you want to output) to see a specific amount of lines of the log. The logfile is also stored and presented at the top of these commands
**Updating Nadeko with pm2**
- If you have set up Nadeko with auto-update, simply run `.die` on your Discord server. That's it.
- If you have set up Nadeko with no auto-update:
- Shut your bot down with `pm2 stop Nadeko`
- Open the installer with `bash linuxAIO.sh` and choose Option `1`
- Once it's done, exit the installer with Option `8` and run `pm2 restart Nadeko`
- You can watch your bot going online with `pm2 logs Nadeko`
#### Using Nadeko with tmux (if you don't want to use pm2)
- On the Terminal, create a new session:
- `tmux new -s nadeko`
The above command will create a new session named **nadeko** *(you can replace “nadeko” with anything you prefer, it's your session name)*.
- Run the installer: `bash linuxAIO.sh`
- Choose `2` to **Run NadekoBot normally**.
- **NOTE**: With this option, if you use `.die` on Discord, the bot will shut down and stay offline until you manually run it again.
- Choose `3` to **Run NadekoBot with Auto Restart**.
- **NOTE**: With this option, the bot will auto run if you use `.die`, making it function as a restart.
If you pick Option `3`, you will be shown the following options:
```
1. Run Auto Restart normally without Updating.
2. Run Auto Restart and update NadekoBot.
3. Exit
```
- With Option `1`, the bot will restart on `.die` command and will not download the latest build available.
- With Option `2`, the bot will restart and download the latest build available everytime the `.die` command is used.
Now check your Discord server, the bot should be online.
- To move the bot to the background, press **Control+B**, release the keys then hit **D**. That will detach the session, allowing you to finally close the terminal window and not worry about having your bot shut down in the process.
**Updating Nadeko with tmux**
- If you're running Nadeko with auto-update, just type `.die` in your Discord server. That's it!
- If you're running Nadeko with **no** auto-update:
- Kill your previous session.
- Check the session name with `tmux ls`
- Kill with `tmux kill-session -t nadeko` (don't forget to replace "nadeko" with whatever you named your bot's session).
- Create a new session: `tmux new -s nadeko`
- Run this command: `cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
- Choose Option `1` to download the most up to date version of Nadeko.
- Once it's done, choose Option `2` or `3` and detach the session by pressing **Control+B**, release then **D**.
**Additional Information**
- If you want to **see the active sessions**, run `tmux ls`. That will give you the list of the currently running sessions.
- If you want to **switch to/see a specific session**, type `tmux a -t nadeko` (*nadeko* is the name of the session we created before so, replace it with the session name you have created).
- If you want to go through the log, press **Control+B**, release the keys then hit **Page Up** or **Page Down** to navigate.
- Don't forget to always detach from the session by pressing **Control+B** then **D** once you're done.
- If you want **create** a new session, run `tmux new -s nadeko`. If you want to **kill it**, run `tmux kill-session -t nadeko`
#### Doing a clean reinstall
- Make a backup of your credentials (`~/NadekoBot/src/NadekoBot/credentials.json`)
- Make a backup of the database (`~/NadekoBot/src/NadekoBot/bin/Release/netcoreapp2.0/data/NadekoBot.db`)
- Make a backup of the images (`~/NadekoBot/src/NadekoBot/data/images.json`)
- Delete the NadekoBot folder
- Install the bot from scratch, replace the files you backed up and run.
#### Help! My music isn't working!
Make sure you have the [Google API Key](../../jsons-explained/#setting-up-your-api-keys) in your `credentials.json`
If music still isn't working, try reinstalling ffmpeg:
- `brew update && brew upgrade` (Update formulae and Homebrew itself && Install newer versions of outdated packages)
- `brew prune` (Remove dead symlinks from Homebrew’s prefix)
- `brew doctor` (Check your Homebrew installation for common issues)
- Then try `brew install ffmpeg` again.
[Prerequisites]: #prerequisites
[Installing Homebrew]: #installing-homebrew
[Downloading and Running Nadeko]: #downloading-and-running-nadeko
[Running Nadeko with the Terminal closed]: #running-nadekobot-with-the-terminal-closed
[Using Nadeko with pm2 (easiest method)]: #using-nadeko-with-pm2-easiest-method
[Using Nadeko with tmux (if you don't want to use pm2)]: #using-nadeko-with-tmux-if-you-dont-want-to-use-pm2
[Doing a clean reinstall]: #doing-a-clean-reinstall
Don't forget to change X.XX.X to match step 2.
```sh
tar xf X.XX.X-linux-x64-build.tar && \
rm -rf nadekobot-old 2>/dev/null && \
mv nadekobot nadekobot-old && \
mv nadekobot-linux-x64 nadekobot && \
rm nadekobot-old/data/aliases.yml && \
rm -r nadekobot-old/data/strings && \
cp -RT nadekobot-old/data/ nadekobot/data/ && \
cp nadekobot-old/creds.yml nadekobot/ && \
cd nadekobot && chmod +x NadekoBot
```

View File

@@ -1,3 +1,9 @@
## Migration from 2.x
⚠ If you're already hosting NadekoBot, You **MUST** update to latest version of 2.x and **run your bot at least once** before switching over to v3.
#### [Windows migration instructions](migration-instructions#windows)
## Setting Up NadekoBot on Windows With the Updater
| Table of Contents|
@@ -15,7 +21,7 @@
#### Prerequisites
- Windows 8 or later (64-bit)
- [Create a Discord Bot application](../../create-invite#creating-discord-bot-application) and [invite the bot to your server](../../create-invite/#inviting-your-bot-to-your-server).
- [Create a Discord Bot application and invite the bot to your server](../../creds-guide.md)
**Optional**
@@ -24,7 +30,7 @@
#### Setup
- Download and run the [NadekoBot Updater][Updater].
- Download and run the [NadekoBot v3 Updater][Updater].
- Click on the + at the top left to create a new bot.
![NadekoBot Updater](https://i.imgur.com/KZV49uf.png "NadekoBot Updater")
- Give your bot a name and then click **`Go to setup`** at the lower right.
@@ -60,7 +66,48 @@ You can still install them manually:
- [ffmpeg-32bit] | [ffmpeg-64bit] - Download the **appropriate version** for your system (32 bit if you're running a 32 bit OS, or 64 if you're running a 64bit OS). Unzip it, and move `ffmpeg.exe` to a path that's in your PATH environment variable. If you don't know what that is, then just move the `ffmpeg.exe` file to NadekoBot/system
- [youtube-dl] - Click to download the file. Then put `youtube-dl.exe` in a path that's in your PATH environment variable. If you don't know what that is, then just move the `youtube-dl.exe` file to NadekoBot/system
[Updater]: https://dl.nadeko.bot/
### Windows From Source
##### Prerequisites
**Install these before proceeding or your bot will not work!**
- [.net 5](https://dotnet.microsoft.com/download/dotnet/5.0) - needed to compile and run the bot
- [git](https://git-scm.com/downloads) - needed to clone the repository (you can also download the zip manually and extract it, but this guide assumes you're using git)
- [redis](https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.msi) - to cache things needed by some features and persist through restarts
##### Installation Instructions
Open PowerShell (press windows button on your keyboard and type powershell, it should show up; alternatively, right click the start menu and select Windows PowerShell), and navigate to the location where you want to install the bot (for example `cd ~/Desktop/`)
1. `git clone https://gitlab.com/kwoth/nadekobot -b v3 --depth 1`
3. `dotnet publish -c Release -o output/ src/NadekoBot/`
4. `cd output && cp creds_example.yml creds.yml`
5. Open `creds.yml` with your favorite text editor (Please don't use Notepad or WordPad. You can use Notepad++, VSCode, Atom, Sublime, or something similar)
6. [Enter your bot's token](#creds-guide)
7. Run the bot `dotnet NadekoBot.dll`
8. 🎉
##### Update Instructions
Open PowerShell as described above and run the following commands:
1. Navigate to your bot's folder, for example `cd ~/Desktop/nadekobot/src/NadekoBot`
2. Pull the latest updates (this will fail if you have custom code changes).
- If you don't have custom code changes, just run `git pull`
- If you do have custom code changes, You have 3 options
- Undo all changes with `git checkout -- * && git pull`
- Stash changes and try to re-apply them `git stash && git pull && git stash apply`
- Commit your changes and resolve merge conflicts `git add . && git commit -m "My commit message" && git pull`
3. Re-run the bot `dotnet run -c Release`
⚠ You're expected to understand that your database will be in `bin/Release/<framework>/data/`, and if `<framework>` gets changed in the future, you will have to move your database manually.
#### Music prerequisites
In order to use music commands, you need ffmpeg and youtube-dl installed.
- [ffmpeg-32bit] | [ffmpeg-64bit] - Download the **appropriate version** for your system (32 bit if you're running a 32 bit OS, or 64 if you're running a 64bit OS). Unzip it, and move `ffmpeg.exe` to a path that's in your PATH environment variable. If you don't know what that is, just move the `ffmpeg.exe` file to `NadekoBot/output`.
- [youtube-dl] - Click to download the file, then move `youtube-dl.exe` to a path that's in your PATH environment variable. If you don't know what that is, just move the `youtube-dl.exe` file to `NadekoBot/system`.
[Updater]: https://dl.nadeko.bot/v3
[Notepad++]: https://notepad-plus-plus.org/
[.net]: https://dotnet.microsoft.com/download/dotnet/5.0
[Redis]: https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.msi
@@ -69,4 +116,5 @@ You can still install them manually:
[SourceGuide]: ../from-source
[ffmpeg-32bit]: https://cdn.nadeko.bot/dl/ffmpeg-32.zip
[ffmpeg-64bit]: https://cdn.nadeko.bot/dl/ffmpeg-64.zip
[youtube-dl]: https://yt-dl.org/downloads/latest/youtube-dl.exe
[youtube-dl]: https://yt-dl.org/downloads/latest/youtube-dl.exe