| tag name | v0.1.2 (e4a0f7144a8c3023c6570f668a4a850052f5bb65) |
| tag date | 2016-12-14 10:55:53 -0800 |
| tagged by | Austin Hellyer <[email protected]> |
| tagged object | commit cc57039339... |
| download | archived-serenity-0.1.2.tar.xz archived-serenity-0.1.2.zip |
|---|
v0.1.2: Framework Revamp
v0.1.2 focuses on revamping the framework, adding a large amount of
configuration and overall features. v0.1.3 will be focused on performance
optimizations and code cleanup.
Thanks to the following for contributions this release:
- [@acdenisSK]
- [@fwrs]
v0.1.2 can now be retrieved from the [crates.io listing].
`UserId::find()` has been added to find the User from cache ([@fwrs]).
`utils::{parse_channel, parse_emoji, parse_role, parse_username}` added to parse
each item from a string; useful for command arguments.
The `CreateEmbed` builder now implements `From<Embed>`, so you can use an
already-built embed from something like a `Message`.
`Context::get_current_user` to retrieve the current user from the cache; prefer
using `CACHE.read().unwrap().user` to avoid a clone.
Implemented `Emoji::url()` and `EmojiIdentifier::url()` to generate URLs for the
emoji's image.
The framework has been revamped:
Structs can now be used as framework command arguments. FromStr is implemented
for:
- `User`
- `UserId`
- `Role`
- `RoleId`
- `EmojiIdentifier`
- `ChannelId`
- `Channel`
You can implement this yourself for your own structs ([@fwrs]).
The framework global configuration now has additional configuration:
- account type to listen to or ignore (selfbot, ignore bots, or listen to
everyone)
- dynamic prefix per context
- multiple prefixes
- error messages for various errors (not enough arguments, command cooldown,
check fails, lack of permissions, etc.)
Commands can now be built with a large amount of configuration via a
`CreateCommand` builder; see example 06 on how to use this. The configuration
for commands includes:
- checks (whether the command should be executed)
- cooldown (ratelimit) bucket
- description (used for the help command)
- usage listing (used for the help command)
- argument quote parsing (parsing `a b c` vs. `a "b c"`)
- required minimum/maximum argument counts
- permissions required to use the command
- whether to display the command in the help message
- whether the command can only be used in DMs or Guilds
Additionally, groups can now be created via the `CreateGroup` builder. It allows
setting the group name (e.g. `"music"`), adding commands to the group, and
setting the group's prefix.
Two default help commands are provided for you if you don't wish to make your
own: one that creates an embed and one that is text-only.
Thanks to [@fwrs] for most work of the work on the framework.
See [example 06][v0.1.2:example 06] for examples on most of this.
- MessageBuilder channel/role/user methods now properly mention the given
item ([@fwrs])
- No-cache+method compiles have been fixed
- `rest::edit_profile` no longer updated the internal token for bot users; this
is a preliminary fix, as the endpoint will soon not return `"Bot "` in the
token key for bot users
- `model::Mention` has been removed, in favour of simply
`model_name::mention()` (BC break) ([@fwrs])
- Ids now mention where possible on format; use Id.0 to format the inner
snowflake directly (BC break) ([@fwrs])
- All internal `try!()`s have been converted to use rustc 1.13's `?`
([@acdenisSK])
- `CreateEmbedImage::{height, width}` and
`CreateEmbedThumbnail::{height, width}` have been deprecated, as these do
not do anything and there seems to not be any plans on Discord's side to make
them do anything. These will be removed in v0.1.3 and the builders themselves
will be replaced with methods on `CreateEmbed` (BC break)