Please make note that Sanara is under the GNU General Public License v3.0
license and any use of her or her source code must comply with it.
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 "token.dat", this file must contain your bot token
(you can obtain is on the Discord developper portail).
- ReThinkdb (database used by Sanara)
- All files needed for game module
- Opus, libsodium, ffmpeg and youtube-dl for radio module
You can also create the following files:
Then go in SanaraV2/Modules/Base/Sentences.cs and modify the following:
- Sanara-7430da57d6af.json: JSON file to Google Translate API, used for translation command
- youtubeAPIKey.dat: Contains your YouTube API key, used for YouTube command and radio
- raven.dat: Contains your Sentry key, used to automate bug reports
- visionAPI.json: Contains your JSON file to Google Vision API, used for translation command
Once it's done, launch Visual Studio and start the project.
- ownerStr is your Discord full name (username#tag)
- ownerId is your Discord ID (to get id, go in a channel and do a left click on your nickname, then do "Copy ID")
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.