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

Komada Extendables #343

Merged
merged 3 commits into from
Sep 2, 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: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased] - Classbased | Staged for 0.20.7
## [Unreleased] - Classbased | Staged for 0.20.8
### Added
- [[#343](https://github.com/dirigeants/komada/pull/343)] Komada extendables are now a thing.
- [[#323](https://github.com/dirigeants/komada/pull/323)] Documentation to all pieces.
- [[#323](https://github.com/dirigeants/komada/pull/323)] Added the types `TextChannel` and `VoiceChannel` to the
compatible types for `SchemaManager`, as a way to prevent security issues.
Expand Down Expand Up @@ -76,7 +77,7 @@ command.
reloading the provider.
- [[#322](https://github.com/dirigeants/komada/pull/322)] **[BREAKING]** `SettingGateway#update`'s arguments are now `key`, `object` and `?guild`, allowing instances of SG which resolver aimed to non-Guild classes to parse correctly. The argument `object` can contain multiple keys. (So SG will update all keys from the object at once). Previously, you could update only a pair `key-value`.
- [[#322](https://github.com/dirigeants/komada/pull/322)] Safer editing when using SettingGateway, now ensuring the settings has been created before inserting the data. (Fixes an issue when the data was inserted without creating it before).
- [[#317](https://github.com/dirigeants/komada/pull/317)] **[BREAKING]** `client.settingGateway` has been changed to
- [[#317](https://github.com/dirigeants/komada/pull/317)] **[BREAKING]** `client.settingGateway` has been changed to
`client.settings`, which is able to handle multiple instances of SettingGateway.
- [[#300](https://github.com/dirigeants/komada/pull/300)] **[Update]** `client.methods.Embed` changed to use Discord.js MessageEmbed.
- [[#297](https://github.com/dirigeants/komada/pull/297)] **[Update]** Abstraction of Settings and slight refactor so its easier to use.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "komada",
"version": "0.20.7",
"version": "0.20.8",
"description": "Komada: Croatian for 'pieces', is a modular bot system including reloading modules and easy to use custom commands.",
"homepage": "https://github.com/dirigeants/komada#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ class Loader {
break;
}
extendable.conf.appliesTo.forEach((structure) => {
Object.defineProperty(Discord[structure].prototype, extendable.conf.method, myExtend);
Object.defineProperty(!extendable.conf.komada ? Discord[structure].prototype : require("komada")[structure].prototype, extendable.conf.method, myExtend); // eslint-disable-line
});
delete require.cache[join(dir, file)];
}
Expand Down
4 changes: 3 additions & 1 deletion src/documentation/ExtendableStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ exports.extend = function() {}; // eslint-disable-line
* @property {String} type Type of extendable. This will be one of the three: "method", "set", or "get".
* @property {String} method The name of this extendable.
* @property {Array} appliesTo An array of Discord.js classes that this extendable will apply to.
* @property {boolean} komada Whether or not this extendable should apply to Komada or Discord.js
*/


Expand All @@ -32,7 +33,8 @@ exports.extend = function() {}; // eslint-disable-line
* exports.conf = {
type: "method",
method: "ping",
appliesTo: ["Message"]
appliesTo: ["Message"],
komada: false
};
*/
exports.conf = {};