Skip to content
This repository has been archived by the owner on Aug 27, 2018. It is now read-only.

[FEATURE] New Configuration System #107

Merged
merged 4 commits into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- New Beta Configuration (Needs heavy testing)

### Removed
- Old Configuration System

## [0.12.4] - 2017-01-13
### Added
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Komada

[![Discord](https://discordapp.com/api/guilds/234357395646578688/embed.png)](http://discord.gg/QnWkbXV)
[![Discord](https://discordapp.com/api/guilds/260202843686830080/embed.png)](https://discord.gg/dgs8263)
[![npm](https://img.shields.io/npm/v/komada.svg?maxAge=3600)](https://www.npmjs.com/package/komada)
[![npm](https://img.shields.io/npm/dt/komada.svg?maxAge=3600)](https://www.npmjs.com/package/komada)
[![Build Status](https://travis-ci.org/eslachance/komada.svg?branch=indev)](https://travis-ci.org/eslachance/komada)
[![David](https://img.shields.io/david/eslachance/komada.svg?maxAge=3600)](https://david-dm.org/eslachance/komada)
[![Build Status](https://travis-ci.org/dirigeants/komada.svg?branch=indev)](https://travis-ci.org/dirigeants/komada)
[![David](https://img.shields.io/david/dirigeants/komada.svg?maxAge=3600)](https://david-dm.org/dirigeants/komada)

> "Stay a while, and listen!"

Expand Down Expand Up @@ -44,7 +44,7 @@ npm install
node app.js
```

> Requires Node 6 or higher (because Discord.js requires that), also requires Discord.js v10, installed automatically with `npm install`.
> Requires Node 6 or higher (because Discord.js requires that), also requires Discord.js v11, installed automatically with `npm install`.

## Quick & Dirty Reference Guide
> For creating your own pieces
Expand Down Expand Up @@ -220,6 +220,9 @@ exports.run = (client, msg) => {
};
```

> Note: Technically, this means that monitors are message events. You can use this trick
to get around the normal amount of message events in Komada.. *cough*

### Using Methods

Methods are just Discord.js native functions added to Komada, so that we may
Expand All @@ -231,7 +234,6 @@ Current Methods are:
Collections => `client.methods.Collection`
Rich Embed Builder => `client.methods.Embed`
Message Collector => `client.methods.MessageCollector`
ShardingManager => `client.methods.Shard`
WebhookClient => `client.methods.Webhook`

To use any of the methods, you follow this same structure:
Expand Down
6 changes: 5 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const Discord = require("discord.js");
const chalk = require("chalk");
const loadFunctions = require("./functions/loadFunctions.js");
const Config = require("./classes/Config.js");

const clk = new chalk.constructor({ enabled: true });

Expand Down Expand Up @@ -28,6 +29,8 @@ exports.start = (config) => {

client.coreBaseDir = `${__dirname}/`;
client.clientBaseDir = `${process.cwd()}/`;
client.guildConfs = Config.guildConfs;
client.configuration = Config;

// Load core functions, then everything else
loadFunctions(client).then(() => {
Expand All @@ -42,6 +45,7 @@ exports.start = (config) => {

client.once("ready", () => {
client.config.prefixMention = new RegExp(`^<@!?${client.user.id}>`);
Config.initialize(client);
for (const func in client.funcs) {
if (client.funcs[func].init) client.funcs[func].init(client);
}
Expand All @@ -53,7 +57,7 @@ exports.start = (config) => {

client.on("message", (msg) => {
if (msg.author.bot) return;
const conf = client.funcs.confs.get(msg.guild);
const conf = Config.get(msg.guild);
msg.guildConf = conf;
client.i18n.use(conf.lang);
client.funcs.runMessageMonitors(client, msg).catch(reason => msg.channel.sendMessage(reason).catch(console.error));
Expand Down
Loading