Skip to content

Latest commit

 

History

History
136 lines (94 loc) · 6.63 KB

README.md

File metadata and controls

136 lines (94 loc) · 6.63 KB

Snowball - Mei's friend Discord Crowdin

Mei has beautiful friend called Snowball, which used to make a Blizzard and cease enemy resistance. Actually, this bot don't used to be in fights, it's just good friend that helps you with your server.

Installing

Compile

To install bot, you need to have installed LATEST version of NodeJS. Then, you should install TypeScript compiler and dependencies by running these commands:

NPM:

npm install --global typescript
npm install

Yarn:

⚠️ YARN IS NOT SUPPORTED AT THE MOMENT. We love yarn, but there's a big problem comes with it: no git subpackages updates. As we started to use alpha releases of discord.js, typings of discord.js don't get downloaded by yarn. It causes errors on build and kills code editor's linting + suggestions.

yarn global add typescript
yarn install

Then try to run build npm script by using this command:

npm build

All compiled files will stay in directory named out.

Setup

Now, after compilation you should setup your bot for working.

Create file named configuration.json in out/config directory. See configuration.example.json

Configuration file properties

  • name (string): Name of the bot, used for output in console
  • token (string): Bot authorization token, get it using My Apps page on Discord Developers site.
  • modules (IModuleInfo[]): Represents an array with information about plugins which will be registered once bot started.
    • name (string): Name of module
    • path (string): Absolute path from cogs directory
    • options (any): Any options for plugin
  • autoLoad (string): Array of names of plugins which should be automatically loaded after registration, be sure you typing their names right: case matters, it's not path.
  • botOwner (string): Your (owner) Discord ID. It gives you permission to call eval command and other stuff which can do damage to bot if you type wrong ID here.
  • localizerOptions (ILocalizerOptions): Configuration for your localizer
    • languages (string[]): Languages code (file names, e.g. en-US)
    • default_language (string): Default language code (it'll be used for new servers)
    • source_language (string): Source language code (it'll be used as fallback)
    • directory (string): Absolute path from out directory
    • disable_coverage_log (boolean, optional): Disables "Translation Coverage" log which shows all untranslated strings
  • shardingOptions
    • enabled (boolean): Enabling of sharding mode
    • shards (number): Number of shards to start
  • queueModuleLoading (boolean, optional): Enable "Queue Mode" loading for modules, will load modules at same time without waiting for init if set to false
  • ravenUrl (string, optional): Your URL for Raven generated by Sentry.io, this allows to catch all the errors in more nicer look

Database

I like to use MySQL database, compatible with nice knexjs library. You need to install it and setup user snowballbot. Put password into environment variable named DB_PASSWD. If you want, you can set different name for user, database name and even host IP using this vars:

  • DB_HOST: Where database hosted (default falls to 127.0.0.1)
  • DB_NAME: Name of database where bot will store their tables
  • DB_PASSWD: Password for database user
  • DB_USER: Name of user who connecting to database

To insure saving of unicode 8 emojis I changed my.cfg (thanks Google):

[mysqld]
init_connect='SET collation_connection = utf8mb4_unicode_ci'
init_connect='SET NAMES utf8mb4'
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
skip-character-set-client-handshake

[mysql]
default-character-set=utf8mb4

Start

You had to setup database, environment variable and configuration json file (locally).

Now, in your out is real distribute of your bot. You pushing it to your VM (VPS) and starting using:

# installing all deps (that's why we copied package.json)
npm install
# making run.sh executable
chmod +x ./run.sh
# then you just starting bot
./run.sh

🎉 Bot should now work. Not works? Create new Issue and I'll gonna say what's wrong

Contribution

Pull Requests

I really appreciate your contribution to this project. You can fix my errors, create new good cogs, but follow these styles:

  • Use Visual Studio Code, it's awesome editor better than others and has good support for TypeScript.
  • Use tslint, it'll notify you if there's an errors in your code. VSCODE EXTENSION
  • Use my universal APIs. I created db, letters, utils, cacheResponse, time, be sure you using them, they pretty simple
  • Make plugin for all servers, not yours one. To be honest, you can create cog for shib channel - that's fine (I included same cogs in source just for fun), but you should provide support for other servers if you making serious plugins like Overwatch statistic.

Don't be scared of making Pull Requests! Make it! I will suggest you what to change, what to not and etc :)

Issues

If you regular user, then report bugs and feedback to Issues section. You also can ask questions there.

Private Modules

You can create private cogs without commiting them to public. Put your cog in private_cogs directory.


BOT MADE WITH ♥ BY DAFRI_NOCHITEROV.

Mei is hero from Overwatch, game created by Blizzard.

Snowball icon originally created by Rubious Marie [?]