Skip to content

Latest commit

 

History

History
107 lines (86 loc) · 8.07 KB

INSTALLING.md

File metadata and controls

107 lines (86 loc) · 8.07 KB

Setup Development Environment

There are a few things that are required to setup a development environment for Xenia

Privileged Gateway Intents

On the Discord Developer Portal make sure that Server Members Intent and Message Content Intent is enabled under the Bot section of your application. It should look like the following screenshot

screenshot

Installing .NET SDK

If you are using Visual Studio 2022/2019, make sure that .NET desktop development is selected under the Desktop & Mobile section of the installer. If you're not sure, open up Visual Studio Installer and click on the Modify button on your installed version of Visual Studio.

Once you've installed the .NET SDK you can launch the Visual Studio solution.

On Linux machines, install the runtime and SDK packages for .NET 8.0 package through Microsoft's Repository. See this guide.

Setup MongoDB Server

To setup the MongoDB server with Docker run the following command.

docker run -p 27020:27017 --name mongodb-xenia-discord -d -e MONGO_INITDB_ROOT_USERNAME=user -e MONGO_INITDB_ROOT_PASSWORD=password mongo

It will set set the username and password to match the following connection URL

mongodb://user:password@localhost:27020

This should be good enough for local testing.

First Run

When you first start Xenia, it will definitely not work at all. Make sure that the following items are set in config.json which is usually located at XeniaBot.Core/bin/Debug/data/config.json relative to the solution directory.

Setup Google Cloud Credentials

Generate your Google Cloud Credentials with this guide. Make sure to export them as a JSON.

Once you've done that, create the GCSKey_Translate key in your config.json and set the value to the content of the JSON.

Note The type of the GCSKey_Translate must match the type GoogleCloudKey in XeniaBot.Shared/_Config/ConfigData.cs

Use Config from Environment

If you wish to fetch the configuration from an Environment Variable then you will need to do the following;

  • Set CONFIG_USE_ENV to true
  • Set the content of CONFIG_CONTENT to a valid config (see schema)
  • OPTIONAL
    • If you want to encode CONFIG_CONTENT in Base64, then set CONFIG_CONTENT_ISB64 to true

Environment Variables

Key Type Default Description
LOG_COLOR boolean true Enable colors in log output (default: true)
CONFIG_LOCATION string ./data/config.json Config file location (default: ./data/config.json )
CONFIG_USE_ENV boolean false Use config from environment, see: Use Config from Environment
CONFIG_READONLY boolean false Disable writing of config. Will always be false if CONFIG_USE_ENV is true
DATA_DIR string ./data/ Data Directory
DATA_DIR_FONTCACHE string ./data/fontcache Font cache for MediaManu commands
LOG_LAVALINK_DEBUG boolean false Enable Debug Logging for Lavalink
LOG_LAVALINK_TRACE boolean false Enable Trace Logging for Lavalink

Config Description

Key Required Default Value Description
DiscordToken ✔️ "" Discord Token from the Developer Portal
DeveloperMode false Restrict all command handling to DeveloperMode_Server, only works for attribute-based commands
DeveloperMode_Server 0 Server Id to restrict command handling when DeveloperMode is true
UserWhitelistEnable false Restrict all command handling to users defined in UserWhitelist, only works for attribute-based commands
UserWhitelist [] Array of user snowflakes that can use the bot when UserWhitelistEnable is true.
Prefix ✔️ "x." Message prefix for text-based commands
ErrorChannel ✔️ 0 Text Channel where errors get reported to
ErrorGuild ✔️ 0 Guild where ErrorChannel is in
MongoDBServer ✔️ "" MongoDB Connection URL, same thing you'd put into MongoDB Compass
BanSync_AdminServer ✔️ 0 Server Id for the admin ban sync logs
BanSync_GlobalLogChannel ✔️ 0 Global Log Channel for Ban Sync. Must be in BanSync_AdminServer
BanSync_RequestChannel ✔️ 0 Channel Id for where the Ban Sync requests go into.
WeatherAPI_Key ✔️ "" API Key for /weather commands. See: https://weatherapi.com
GCSKey_Translate null See Setting up Google Cloud Credentials
ESix_Username ✔️ "" Username for /esix commands. See this Steam guide for instructions.
ESix_ApiKey ✔️ "" Api Key for /esix commands. See this Steam guide for instructions.
Prometheus_Enable ✔️ true Enable Prometheus Exporter
Prometheus_Port ✔️ 4823 Port for Prometheus Exporter
Prometheus_Url ✔️ "/metrics" Base Url for Prometheus Exporter
Prometheus_Hostname ✔️ "+" Hostname to listen Prometheus Exporter on
Invite_Permissions ✔️ 415471496311 Permissions for the /invite command. Use the permissions generated with this website.
AuthentikToken "" Api Token for /auth commands.
AuthentikUrl "" Base Url for Authentik server.
AuthentikEnable false Enable /auth commands.
HasDashboard false Should the bot say that there is a dashboard in the /dashboard command
DashboardLocation ✔️ "" Dashboard Url that is used in the /dashboard command
DiscordBotList_Token "" Token to use when sending available commands to DiscordBotList.com
OAuth_ClientId ✔️ (Dashboard Only) "" Discord OAuth Client Id
OAuth_ClientSecret ✔️ (Dashboard Only) "" Discord OAuth Client Secret
Health_Enable ❌ (Bot Only) false Enable Health API
Health_Port ❌ (Bot Only) 4829 Port to listen the Health API Web Server
BackpackTFApiKey null API Key for backpack.tf. Required for the /tf2 currency command