Please make note that Sanara and this website are under the GNU General Public License v3.0
license and any use of her or her source code must comply with it.
If you have a suggestion/problem you can open an issue/pull request on the corresponding GitHub repository:
Translate Sanara in your own language▼
To begin with, you'll need to fork and clone the Translation repository.
If your language doesn't exist, you'll need to create a folder with your language 'code' in the Translations directory.
Language code must be follow ISO 639-1 (ex: 'fr' for French, 'ja' for Japanese, etc...).
Then inside begin by creating a infos.json file that will contains the 2 following keys:
For example, with french 'nameEnglish' would be 'french' and 'nameLanguage' would be 'français'
- nameEnglish: The name of the language in the english language
- nameLanguage: The name of the language in your language
Then create a terms.json file and write all your translations here, the easiest way to know the different keys is to take the
english terms.json as an example.
If your language already exist, then you just have to modify the terms.json file.
Either way, once you are done just do a pull request.
Using Sanara by cloning the repository▼
At first you'll need to clone Sanara repository recursively (so the translation module is cloned too)
git clone --recurse-submodules https://github.com/Xwilarg/Sanara.git
Then launch install.sh, it'll download the following:
Once the script is done, go in SanaraV2/bin/Debug/Keys and create a file named "Credentials.json", this file will contains all your keys in the JSON format:
- ReThinkdb (database used by Sanara)
- All files needed for game module
- Opus, libsodium, ffmpeg and youtube-dl for radio module
"botToken" : "AAABBBCCC",
There are 3 mandatory values:
The only mandatory value is your bot token named "botToken" (you can obtain it on the Discord developper portail).
- botToken: Your bot token (you can obtain it on the Discord developper portail)
- ownerId: Your Discord ID (to get it you can write \@YourName in a chat)
- ownerStr: Your Discord full name (YourName#0123)
You can also have the following optional fields:
Once it's done, launch Visual Studio and start the project.
- websiteStats: Contains the website in which Sanara's stats are sent
- websiteStatsToken: Authentification token for sending stats
- googleTranslateJson: Path to the JSON to use the Google Cloud Translation API (used for the translation command)
- googleVisionCloud: Path to the JSON to use the Google Cloud Vision API (used for the translation command)
- youtubeKey: Your YouTube API key (used for the youtube command and the radio module)
- githubKey: Your GitHub API key (used for the logs command)
- ravenKey: Your Sentry API key (error reporting)
- discordBotsId: ID of the bot in discordbots.org
- discordBotsToken: Token of the bot in discordbots.org
- kitsuEmail: Your email on kitsu.io (used for anime/manga commands, to serach for NSFW content)
- kitsuPassword: Your password on kitsu.io
If you want to be sure that everything was loaded properly, you can launch the 'status' command.
To begin with, you'll need to fork the repository and to setup the bot as described in the previous step.
At first, you need to understand that Sanara work by modules, the best way to understand that is to have a look at her commands.
All interractions with Discord are located in the 'Modules' folder, command management (processing datas) in done in the 'Features' folder.
Some modules aren't concerned because they are too 'close' to Discord (meaning that the only things they would do would interracting with it), these are the following: Communication, Information, Radio and Settings.
Everything related to games is also in a separated folder so modifying them is way easier (because games have a lot of interractions with everything).
Each 'Modules' subfolders contains a file named 'Sentences.cs', it's because everything the bot say must be available for translation (see the first section of this page).
If you want to create a new game you must do the following:
Your last step would be to make sure everything still work, for that you can launch Sanara's unit tests.
- Create your game in SanaraV2/Games/Impl (you must inherit AGame or AQuizz)
- In SanaraV2/Games/Constants.cs you must add it to the 'allGames' and the 'allDictionnaries' arrays.
For that, I recommand using Chocolatey, once you have installed it you can do "choco install xunit" to install xunit.
Then go in Sanara's root repository with Powershell and execute the following line:
OpenCover.Console.exe -register:user -target:"xunit.console.x86.exe" -targetargs:".\Sanara-UnitTests\bin\Debug\Sanara-UnitTests.dll -noshadow"
Once you are satisfied of your work, you can do a pull request.