Update README.md
Create a more verbose and useful readme for setup on other servers.
This commit is contained in:
86
README.md
86
README.md
@@ -1,3 +1,87 @@
|
||||
# Sweetbot
|
||||
|
||||
Sweetgums Discord bot for pulling character images/stats/daily rankings
|
||||
A simple Discord bot for pulling character images/stats/nightly rankings posts, using the maplestory.io API to build images. This bot was originally designed to work with a Cosmic v83 database and EXP table. If you're using a different source, you may need to change these.
|
||||
|
||||
## Usage
|
||||
|
||||
Clone the repository with your preferred method:
|
||||
|
||||
`git clone https://git.bitbouquet.network/Sweetgum/Sweetbot.git`
|
||||
|
||||
Edit env.example and update the following environment variables:
|
||||
|
||||
Discord:
|
||||
```
|
||||
DISCORD_TOKEN = "your discord bot token"
|
||||
DISCORD_CLIENT_ID = "your application client ID here"
|
||||
DISCORD_GUILD_ID = "your guild ID here"
|
||||
|
||||
BOT_PREFIX = ! (change this if you'd like to use something other than '!' to call the bot)
|
||||
|
||||
RANKINGS_CHANNEL_ID = "your rankings channel ID"
|
||||
```
|
||||
Database:
|
||||
```
|
||||
DB_HOST = "localhost" (Change this if you're not running the bot on the same database host)
|
||||
DB_PORT = 3306 (Change this if your database uses a different port)
|
||||
DB_USER = "your db user"
|
||||
DB_PASSWORD = "your db password"
|
||||
DB_NAME = cosmic (Change this if you've changed your database name, or if using a different source)
|
||||
```
|
||||
|
||||
Copy env.example to a .env for Node to use your configuration.
|
||||
|
||||
## Reccommendations
|
||||
|
||||
It is NOT ADVISED to use the root user for the database when running this bot. Create a minimum-permissions service user instead.
|
||||
|
||||
Run the following commands in a MySQL shell:
|
||||
```
|
||||
CREATE USER 'service_user'@'%' IDENTIFIED BY 'your_password_here';
|
||||
|
||||
GRANT SELECT ON cosmic.characters TO 'service_user'@'%';
|
||||
GRANT SELECT ON cosmic.inventoryitems TO 'service_user'@'%';
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
`'@''%"` allows for connections from any host. If your bot runs on the same server, it's reccommended to limit it to 127.0.0.1/localhost.
|
||||
|
||||
It is reccommended to run the bot as a system service, so it continues to run once you exit the shell. It will also log activity & console output to the journal. For any systemd-based Linux distro, do the following:
|
||||
|
||||
Create a systemd service file:
|
||||
`sudo nano /etc/systemd/system/sweetbot.service`
|
||||
|
||||
Use this template, adjusting the paths to match where your bot runs:
|
||||
```
|
||||
[Unit]
|
||||
Description=Sweetbot
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User='your_linux_user_here"
|
||||
WorkingDirectory=/your/sweetbot/directory
|
||||
ExecStart=/usr/bin/node /your/sweetbot/directory/bot.js
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
Note: The node.js binary may exist in a different directory depending on your OS. Use `which node` to determine that.
|
||||
|
||||
Enable and start it:
|
||||
```
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable sweetbot
|
||||
sudo systemctl start sweetbot
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
Lynx: Providing information on interacting with maplestory.io
|
||||
maplestory.io: y'all are the goats
|
||||
|
||||
## Extra Information
|
||||
|
||||
Creating a Discord bot is a fairly simple process. For more information on how to create a Discord bot/application, please visit https://docs.discord.com/developers/quick-start/getting-started
|
||||
Reference in New Issue
Block a user