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

Remove fetchMessages duplicate code #225

Merged
merged 2 commits into from
May 12, 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 @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Command Cooldowns are now available through a new inhibitor/finalizer combo. Simply set command.conf.cooldown to an integer in seconds to put a cooldown on that command.

### Changed
- Changed fetchMessages to fetchMessage (backend change)
- Backend is now class based. Users main files will need to be updated. The interface is the same as creating a discord.js client, only using komada, and with komada config. No more use of start, but client.login(token) is needed now.
- Usage will no longer be calculated everytime a command is run, but instead stored in command.usage.
- Usage has been refactored into a ParsedUsage class, and an argResolver class. (internal)
Expand All @@ -29,7 +30,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Use Discord.Permissions to generate and keep cached an implied permissions object, instead of generating a new object every time a command is run.

### Fixed
-
-

### Removed
- generateInvite.js core function in favor of the Discord.JS generateInvite.
Expand Down Expand Up @@ -377,4 +378,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
[0.12.4]: https://github.com/dirigeants/komada/compare/0.12.0...0.12.4
[0.18.0]: https://github.com/dirigeants/komada/compare/0.12.4...0.18
[0.18.1]: https://github.com/dirigeants/komada/compare/0.12.4...0.18.1
[0.19.0]: https://github.com/dirigeants/komada/compare/0.18.1...0.19.0
[0.19.0]: https://github.com/dirigeants/komada/compare/0.18.1...0.19.0
9 changes: 0 additions & 9 deletions classes/argResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ module.exports = class ArgResolver {

async msg(arg, currentUsage, possible, repeat, msg) {
if (/^\d+$/.test(arg)) {
if (this.client.config.selfbot) {
const mes = await msg.channel.fetchMessages({ around: arg }).catch(() => {
if (currentUsage.type === "optional" && !repeat) {
return null;
}
throw `${currentUsage.possibles[possible].name} must be a valid message id.`;
});
return mes.filter(ele => ele.id === arg).first();
}
const mes = await msg.channel.fetchMessage(arg).catch(() => {
if (currentUsage.type === "optional" && !repeat) {
return null;
Expand Down