LeaPhant / flowabot

Modular Discord bot with fun features including twitch commands and advanced osu! commands. 🌷

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows System Fix

Jouveer opened this issue · comments

After trying to get the bot to work with windows, I seem to have found a solution where everything I have tested is working.

Bot setup instructions Windows 10:

1. Install Ubuntu
Execute this command and restart PC.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
1b. Download Ubuntu from Microsoft Store and install

Run the following commands through Ubuntu

2. Update
sudo apt-get update
sudo apt-get upgrade

3. Install NodeJS
sudo apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs

4.Install GCC through build-tools
sudo apt install build-essential

5.Install Node-gyp
sudo npm install -g node-gyp

6.Create a discord bot
https://discordapp.com/developers/applications/

7.Create osu! API Key
https://osu.ppy.sh/p/api/

8.Install .NET SDK
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2

If you are unable to locate the package:
sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2

9.Install Node Canvas
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
npm install canvas

10.Clone Repository and build
cd
git clone https://github.com/LeaPhant/flowabot.git

If you want PP command:
cd
git clone --recurse-submodules https://github.com/ppy/osu-tools
cd osu-tools/
sudo ./build.sh

11.Set Up Bot
cd
cd flowabot
npm i
npm run config
Set up the bot how you would like, using your discord bot info and osu! API Key.
Performance calculator dll should be located at:
/home/**YOUR USER**/osu-tools/PerformanceCalculator/bin/Release/netcoreapp2.0/PerformanceCalculator.dll

12.Set Up Emojis
Let bot join your server:
https://discordapp.com/api/oauth2/authorize?client_id=**YOUR-CLIENT-ID**&permissions=8&scope=bot
Still within flowabot directory:
npm run emojis
The server index should be 0 if the bot is only on 1 server.

13.Start Bot
npm start

If anything is not working then I will try to help, the guide is just written from memory so I may have forgotten something.
File system is located at:
C:\Users\**USER**\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs

Thank you for this, I will link this in the README if it's ok cause I don't really want to work on Windows support.

No problem,
Sure, you can add it to the README if you'd like.

Tried this and it went well until I tried to install canvas, got hit with some permission errors but adding --unsafe-perm=true at the end of sudo npm install canvas made it run. Then cloning gave a couple warnings about permissions, and npm i just doesn't work (apparently an issue w/ npm intself)

If you send a screenshot of the error message then I can try to help. I may have forgotten something in the instructions so will try to pinpoint what it is if I have.

Sure thing.
This is what I got trying to install canvas.
However running it with the --unsafe-perm=true gave me this, which looks a lot better.
Cloning the osu-tools repo gives me this warning, although building it ran fine. Trying to clone flowabot gave me the same warning
Finally running npm i gives me a massive list of permission denied errors, culminating in an error saying cb() never called!.
I tried to see if sudo npm i would be any different, and it ended up looking like this generating this and this in the error log (had to split it up bc pastebin size limitations).
Anything else you might need lmk. Appreciate your help a ton :)

@davson19
Try this in the home user directory of Ubuntu
sudo mkdir ~/.npm-global
sudo npm config set prefix '~/.npm-global'
source ~/.profile

Then try to install canvas again

Delete the broken clones
If the build went fine then you probably don’t need to do this, you can try it to be sure if you want

sudo rm -rf flowabot/
sudo rm -rf osu-tools/
sudo chown -R $(whoami) .config
Then try to clone repos again
Build osu-tools if you deleted it anyway

Tell me if that works for you, think I faced the same issue but thought it wasn’t a nessessary step for everyone.
Will update the guide if this works for you

No luck sadly, and trying to use sudo didnt work either

What does this return?
find ~/node_modules/ -printf '%u\n' | sort -t: -u

If there is anything besides your user listed then try to do
sudo rm -rf node_modules/
npm install -g node-gyp without sudo
npm install canvas without sudo

Only root gets printed

Try sudo chown -R $(whoami) node_modules/
Then make sure other installations are correct with
npm install -g node-gyp without sudo
npm install canvas without sudo

When I run the command I get my user account as owner, not root.
Hopefully setting the ownership to you will fix the permission error.