Contributing to Gravebot is super easy, we just have a few rules.
Gravebot is written in ES6/Babel javascript, we try to keep to that, then the ES5 alternatives.
- No using
var
, instead properly usinglet
andconst
- Using
import
andexport
for modules, and avoiding usingrequire
unless it's for JSON - All variables are
snaked_case
- All functions are
camelCased
- Everything must pass lint (
npm run lint
) - Tests are required for all functions
- Avoid adding new modules if there is already one that does something similar. For example, don't add
lodash
as we're already usingramda
, or don't addQ
as we're already usingbluebird
- Avoid adding images to the repo if possible, but instead upload them to imgur to improve performance
Creating a new module
To add a new command, create a new javascript file in /src/commands
and name it to something that resembles your to be functions. For example all the Discord server commands can be found in /src/commands/info/index.js
.
All functions are passed the Discordie client, message event, the command suffix, and the users language. All functions are to return a Bluebird promise of either a string, number, or Buffer. An array of any of the three is also accepted. A good example of this can be found in /src/commands/fun/translate.js
.
It's good to default to some help text if someone is improperly using your commands. With a little string interpolation and some markdown it's pretty easy to describe to a user how your commands work. Check out /src/commands/games/leagueoflegends/
or /src/commands/help
.
After you've completed writing, export a default object with the key name being the name of the discord command. Again, a good example of this can be found in /src/commands/fun/translate.js
. You can export multiple commands and everything will be merged on run.
Image Responses
If you'd prefer to develop an image response instead of a text response, take a look at the League of Legends items
commands. The images are HTML/Jade views using Stylus as the css pre-compiler. The images should try to fit in with the look of Discord. Please refrain from loading remote dependencies, but instead save them locally in the repo within the web
folder.
Tests
Tests are required for all new functions, examples can be found in /tests This project already uses mocha
, nock
, chai
, and sinon
, which should be more than enough to write any tests needed. Tests are run with npm run mocha
.
Pull Requests
Once everything is up to par, feel free to through up a pull request. For pull request formatting, check out #7 and #2
We use Transifex to manage all translations, it's super easy and lets everyone contribute! The initial translations were done with Google Translate, so just because a translation exists doesn't mean it's correct. You can also check out the language status list below to see which have been done by Google, and which has had attention from a native speaker.
Rules
- Make sure to check if a translation has been done already before writing it over again.
- If you have an issue with someone else's translation, please use the comments section.
- Don't add extra punctuations (such as
...
) to the end of translations if the English version doesn't have it.
Setup
- Create an account on Transifex (Or login with Github/Google/Facebook/ect)
- Join the Gravebot team with the language you'd like to work on
- Start!
Language Status
Language | Finished |
---|---|
English | Yes |
Arabic | No |
Bosnian | No |
Bulgarian | No |
Catalan | No |
Croatian | No |
Chinese Simplified | No |
Chinese Traditional | No |
Danish | No |
Dutch | No |
Finnish | No |
French | No |
German | No |
Georgian | No |
Greek | No |
Hebrew | No |
Hungarian | No |
Indonesian | No |
Italian | No |
Japanese | No |
Korean | No |
Latvian | No |
Lithuanian | No |
Malay | No |
Norwegian | No |
Polish | No |
Portuguese | No |
Portuguese Brazil | No |
Romanian | No |
Russian | No |
Serbian | No |
Slovak | No |
Slovenian | No |
Spanish | No |
Swedish | No |
Thai | No |
Turkish | No |
Vietnamese | No |
Please prevent from putting translations in PRs, we'd rather keep those for code.