discord-akairo

A bot framework for Discord.js.

MIT License

Downloads
744
Stars
556
Committers
44

Bot releases are hidden (Show)

discord-akairo - 7.3.1

Published by 1Computer1 over 7 years ago

Fixes

  • Fixed fetchMembers option not fetching members before command.

  • Fixed argument splitting regexes, they really really should be consistent now.

discord-akairo - 7.3.0

Published by 1Computer1 over 7 years ago

Additions

  • Added CommandUtil, available on messages that go through the command handler as Message#util.

    • Can be disabled with commandUtil option.
    • Can be removed over time to alleviate memory use with commandUtilLifetime option.
    • Contains prefix and alias which shows how the command was called.
    • Contains methods which sends a response or edits a previous response.
      • send, reply, sendCode, etc.
      • Only does edits on editable commands and with handleEdits on.
      • Also checks for attachments and prompt responses.
  • Added options for checking permissions.

    • Can be an array of permission names.
      • Permissions are channel-specific.
      • Only used when in guilds.
    • Can also be a function returning true or false.
    • CommandOptions#clientPermissions.
      • Runs for the client.
      • Emits commandBlocked with reason of clientPermissions.
    • CommandOptions#userPermissions.
      • Runs for the command user.
      • Emits commandBlocked with reason of userPermissions.
  • Added a bunch of new argument types.

    • lowercase
    • uppercase
    • charCodes
    • memberMention
    • channelMention
    • roleMention
    • emojiMention
    • commandAlias
    • command
    • inhibitor
    • listener
  • Added keys param to SQLiteHandler#get that allows for getting specific keys.

  • Added an argument split of none that does the entire content.

  • Added support for links inside <> for the url type.

  • Added support for using an array inside the array for argument types.

    • The first element of the inner array will be used.
  • Added support for loading JSON objects with AkairoHandler.

  • Added support for loading modules exporting classes.

    • Options that can take a function can be assigned as a method.
    • See tutorial #12 for an example.

Changes

  • Changed split regexes in order to be more consistent with each other.
    • This fixes some problems with whitespace and new lines.

Fixes

  • Fixed AkairoClient#login not resolving with token like in Discord.js.

  • Fixed desanitizing in SQLiteHandler#get when used with an ID that does not exist.

  • Fixed reloadAll when an object with no filepath was loaded.

  • Fixed invalid typings with some options and message-related properties.

  • Fixed flag and prefix arguments taking the first rather than the last match.

discord-akairo - 7.2.2

Published by 1Computer1 over 7 years ago

Additions

  • Updated typings to take into account this context.

Changes

  • Handlers no longer load modules on creation, AkairoHandler#loadAll must be called first.
    This is done automatically if you call build() or login().

  • Made docs cleaner by moving from HTML to Markdown.

Fixes

  • Fixed the AkairoHandler#load event not firing on Listeners for when modules are loaded on building.

  • Fixed missing and wrong typings, changed some void to any.

discord-akairo - 7.2.1

Published by 1Computer1 over 7 years ago

Additions

  • Added AkairoHandler#load event (and anything that extends it).

  • Added typing for private methods.

Changes

  • Reworked how modules are loaded slightly.

  • Loading now ignores files not ending with .js.

discord-akairo - 7.2.0

Published by 1Computer1 over 7 years ago

Additions

  • Allowed ArgumentSplit to take a function that returns an array of strings.

  • Added an ArgumentMatch of none that does not match anything and gives an empty string.

  • Added option infinite for argument prompting, which collects input until stopped.
    Also comes with prompt option stopWord for stopping the collecting.

  • Added a check for duplicate command aliases.

  • Added ClientUtil#promptIn for prompting to a user in a channel/DM without a prior message to refer to.

  • Added command option typing that makes commands type during execution.

Changes

  • Made all inputs trimmed before being passed to the type resolvers.

  • Made param content for ClientUtil#prompt optional.
    This also means you can return empty strings for argument prompt functions.

  • Made some properties unassignable and vice versa.
    The properties made unassignable were marked as read-only in the first place.

Fixes

  • Fixed the absence of inhibitors running on regex and conditional commands.

  • Fixed arrays not being joined properly for prompt messages.

  • Fixed ClientUtil#fetchMessage for non-bots when message is not found.

  • Fixed (as in, disabled) reloading for modules loaded as an object.

  • Fixed removing for modules loaded as an object.

  • Fixed command trigger function having to be ran twice for getting regex.

  • Fixed missing typings, hopefully.

discord-akairo - 7.1.0

Published by 1Computer1 over 7 years ago

Changes

  • AkairoHandler#load can now load objects.

  • A function is now allowed for ArgumentMatch.

  • String literals are now allowed in args prompts.
    They will have a mention concatenated to them, like Message#reply.

  • When returning an object for args prompts, a content property can now be used.
    It will determine the text content of the sent message.

  • Regular expressions can now be used an an argument type.
    Will be evaluated into full match and group matches.

  • Added TypeResolver#addTypes and TypeResolver#addType can now overwrite previous types.

  • Added argument types url, date, color, message, and invite.

  • Added command prefix overwriting.

  • Added ClientUtil#fetchMessage.
    Contains a fallback if the client is not a bot.

  • Added a param of previous arguments to args functions (type, match, default, prompts).

  • Added a param for retry count to args prompt functions.

  • Added inversion of the final value for flag args.
    Can be done by setting default to something truthy.

  • Added new client option fetchMembers to make sure that members are cached.

  • Made ClientUtil#resolvePermissionOverwrite return a modified copy of the passed object.

  • Made several methods that were returning nothing to return something.

  • Made strings be trimmed for quoted/sticky split.

  • Fixed array of prefixes not being case-insensitive.

  • Fixed flag and prefix args not being case-insensitive.

  • Fixed the parser considering flag args as prefix args.

  • Fixed a new line before args in command causing command not to be found.

  • Fixed args default not defaulting to empty string.

  • Fixed handleEdits option not doing anything when changed to false after login.
    Adding the functionality after login will have to be done manually.

  • Fixed some incorrect typings.

discord-akairo - 7.0.2

Published by 1Computer1 over 7 years ago

Changes

  • Fixed a bad bug that duplicated prompts.
discord-akairo - 7.0.1

Published by 1Computer1 over 7 years ago

Changes

  • Better support for functions returning a Promise in ArgumentType.
    Rejecting the Promise will do the same thing as returning null in a non-Promise type function.

  • Faster command lookup with aliases.

discord-akairo - 7.0.0

Published by 1Computer1 over 7 years ago

Breaking Changes

  • Changed how ongoing argument prompts are stored.

  • Removed all the handler and modules alias getters (e.g. CommandHandler#commands or Command#commandHandler).

  • Removed postInhibitors option and split up the preInhibitors option to blockNotSelf, blockClient, and blockBots.

Changes

  • Added TypeScript typings.

  • Added CommandHandler methods: addPrompt, removePrompt, and hasPrompt.
    Used for making sure that another command isn't called when a user is in a prompt.

  • Added TypeResolver#addType to make things cleaner when adding types.

  • Added iterable as second param in Category constructor.

  • Added inhibitor type all for an inhibitor to run on all messages.

  • Made AkairoClient#addDatabase return the client.

  • Made AkairoClient#login not call init and load on databases unless they have those methods.

  • Made AkairoClient#login not handle messages until after ready.

  • Removed dependency on readdir-recursive.

  • Fixed ClientUtil#prompt collecting the sent message.

discord-akairo - 6.1.2

Published by 1Computer1 over 7 years ago

Changes

  • Fixed a bad thing with optional prompt and default.

  • I am bad at finding bugs.

discord-akairo - 6.1.1

Published by 1Computer1 over 7 years ago

Changes

  • Fixed endless command execution if message was edited to blank.
    Seems to be a Discord.js bug.

  • Fixed guild resolvers/check.

  • Made number types check better.
    Because isNaN doesn't work on strings with whitespaces only.

discord-akairo - 6.1.0

Published by 1Computer1 over 7 years ago

Changes

  • Added ability to handle message edits to run commands.
    See tutorial #9 and the docs for specifics.

  • Allow prompt message functions to return an array.

  • Added prompt option optional.
    Prompts only when argument is provided but was not of the right type.

  • Changed default prompt start message to be a bit nicer.

  • Added getters to Argument (e.g. this.client).

  • Added message options to ClientUtil#prompt.
    This means embeds for argument prompting!

  • Added command option protected to prevent disabling.

  • Fixed trigger and condition commands running when disabled.

  • Removed property CommandHandler#cancelWord that was added on mistake.

discord-akairo - 6.0.1

Published by 1Computer1 over 7 years ago

Changes

  • Minor docs fixes.
discord-akairo - 6.0.0

Published by 1Computer1 over 7 years ago

Breaking Changes

  • Renamed defaultValue to default for ArgumentOptions and it is now always a function on an Argument instance.

  • Discord-related argument types are now not whole word match.

  • Discord-related argument types now do not resolve the default argument value.

  • Removed assignment of CommandOptions#custom, only CommandOptions#options is assigned now.

  • Changed return type of ClientUtil#compareStreaming to number.

  • Made ClientUtil#resolvePermissionOverwrite return object with allow and deny property to be consistent with Discord.js.

  • Renamed ClientUtil#hoistedRole to ClientUtil#hoistRole.

  • Changed the second param of ClientUtil resolvers to take a Collection of their respective type instead.

Big Changes

  • Added Argument class to handle argument creation.
    Usage of arguments are mostly the same but this may break some cases.

  • Handlers are now created when AkairoClient#login is called.
    Allows for replacing handlers or adding things to the client before login.
    This may break some things, but should really not.

Changes

  • Added TypeResolver class to handle argument types.
    Allows for adding new types instead of copy pasting the same function over and over.

  • Added argument prompting.
    See tutorial #8 and the docs for the specifics.

  • Added ratelimit option to CommandOptions.
    Allows for certain amount of uses before cooldown kicks in.

  • Added more ClientUtil methods: collection, prompt, resolveUsers, resolveMembers, resolveChannels, resolveRoles, resolveEmojis, and resolveGuilds.

  • Added new types to use those new methods: users, members, channels, textChannels, voiceChannels, roles, and emojis.

  • Added new types: relevant, relevants, guild, and guilds.

  • Fixed empty string not working in array of prefixes.

discord-akairo - 5.2.1

Published by 1Computer1 over 7 years ago

Changes

  • Quick fix for cooldowns so that they won't be used when not needed.
discord-akairo - 5.2.0

Published by 1Computer1 over 7 years ago

Changes

  • Added condition commands.
  • Added cooldowns for commands.
  • Added mem, an empty object, to AkairoClient.
  • Default config values can now be JSON strings.
  • Fix rest arg match being sliced in quoted commands.
discord-akairo - 5.1.2

Published by 1Computer1 over 7 years ago

Changes

  • Fixed wrong reference of this in args functions.
  • Fixed wrong info in the SQLite tutorial.
discord-akairo - 5.1.1

Published by 1Computer1 over 7 years ago

Changes

  • Quick update to fix some dumb problems:
  • Flag arguments no longer break the args.
  • Fixed SQLiteHandler#get for null values.
  • Fixed emitters loading.
  • Fixed AkairoHandler#reloadAll.
  • Fixed multiple trigger commands not triggering.
discord-akairo - 5.1.0

Published by 1Computer1 over 7 years ago

Changes

  • Added trigger option to commands.
    Lets you run a command from matching a regex.
    See tutorial #7 for example usage.
  • Command split can now be a regex/character for a custom split.
    This will change the exec function parameters.
  • Removed the auto error logging, instead a CommandHandler#error event has been added.
  • Inverted the preInhibitors and postInhibitors option.
    I'm sorry I didn't notice it was the wrong way around. D:
  • Optimization (forEach replaced with for of).
discord-akairo - 5.0.2

Published by 1Computer1 over 7 years ago

Changes

  • Split up AkairoOptions and ClientOptions.
    If clientOptions are not specified, options will be used as both, like before.
  • Exposed ClientUtil.
  • Made errors slightly more descriptive.
  • Fixed returns for some module methods.
  • Fixed database loading. (!!!)
Package Rankings
Top 2.71% on Npmjs.org
Related Projects