v0.6.0-rc.0
Thanks to the following for their contributions:
- acdenisSK
- andreasots
- Celti
- DarkKirb
- eatsfoobars
- Erk-
- FelixMcFelix
- Flat
- hyarsan
- Kroisse
- Lakelezz
- Mishio595
- PvdBerg1998
- Roughsketch
- zeyla
Release candidate
This is a testing release for receiving feedback regarding the new big changes introduced, whether they’re satisfactory, or horrid and should be revised, before we officially stabilise them.
Please inform us of any suggestions, or bugs you might have!
Major breaking changes
Serenity has migrated to the 2018 Rust edition, whose lints and idioms are enforced in its codebase.
The cache and http are no longer globally accessible. The Context
now carries instances to them, and as such, all functions that had used the cache and http before, now accept the context as their first parameter in order to operate. Passing the fields present on the context is acceptable too.
The framework had been swayed off of builders, and proselytised to procedural, macro-based attributes.
Giving options to your commands might have looked like this:
command!(foo(ctx, msg, args) {
...
});
framework.command("foo", |c|
c.description("I am foobar")
.min_args(1)
.max_args(2)
.usage("#foo bar baz")
.cmd(foo));
But now, it will be:
#[command] // Marks this function as a command.
#[description = "I am foobar"] // These are the "parameter" attributes, for providing the options to the attribute macro.
#[min_args(1)]
#[max_args(2)]
#[usage("#foo bar baz")]
fn foo(ctx: &mut Context, msg: &Message, args: Args) -> CommandResult {
...
Ok(())
}
The same happened to creating groups, but with macro!
style flavour, which have become a compulsory step in registering your commands:
group!({
name: "fizzbuzz",
options: {
prefix: "fezz",
...
},
commands: [foo],
});
All .command
s and .on
s are thus replaced with simple calls to .group
:
framework.group(&FIZZBUZZ_GROUP); // !
! - procedural macros are functions that accept Rust code, return Rust code. The Rust code that the #[command]
(and similarly, group!
) macro generates is the function you supplied it with, and a static
instance of options that you've configured the command with. The static is assigned a suffixed, all uppercase version of the function’s name (or in the case of group!
, of the name
field). Hence this weird identifier from nowhere.
Book
To help new (and existing) users familiarise themselves with the library better, we have decided to write a book similar to one of Rust's official learning material to the language, The Book.
It's no ready yet, but we hope that on its release that it will clear misunderstandings (if any), explain the why and how of the library and put you in the right direction of Discord bot making!
Added
- [builder/model] Permit sending files through the
CreateMessage
builder. (@Roughsketch) c:5405ac2 - [client] Add Rich Presence parsing support (@zeyla) c:f7360e6
- [model] Add Slow Mode Rate (@Lakelezz) c:7512c19
- [voice] Voice reconnection (@FelixMcFelix) c:25cb595 c:4026d77 c:2f613c0 c:0a58e85
- [model] Add a position propagation method to Channel (@Erk-) c:59b4c60
- [misc.] Re-export
typemap::sharemap
(@zeyla) c:d2233e2 - [framework] Add new Check System (@Lakelezz) c:2969561
- [http/gateway] Rustls support (@Erk-) c:faa773a
- [model] Add news channel (@Lakelezz) c:1074b28
- [client] Add EventHandler for raw Events (@DarkKirb) c:2b453c3
- [model] Add millisecond accuracy to
ID.created_at()
(@DarkKirb) c:965fa7b - [http/gateway] Add Rustls and Native-TLS Backends (@Lakelezz) c:15e2c41
Changed
- [model] Make MessageUpdateEvent::embeds a Vec (@zeyla) c:00f465c
- [voice] Voice fixes, better API adherence, bitrate control, documentation (@FelixMcFelix) c:393a5ae
- [builder] Make builders mutably borrowed (@zeyla, @Flat, @Lakelezz, @Celti) c:1546171 c:6d87d71 c:b7a6fee c:b012ab7
- [utils] Make Message Builder use &mut self instead of self (@PvdBerg1998) c:1546171
- [misc.] Update
parking_lot
andmultipart
dependencies (@Kroisse) c:1e50d30 - [framework] Make sure
delimiter
clears current and default delimiters. (@Lakelezz) c:3f81cf3 - [framework] Underline command name and "Commands" in plain help (@hyarsan) c:87bc6ca
- [http] Replace
hyper
withreqwest
(@Lakelezz) c:86a8b60 - [client/gateway] Switch to tungstenite from rust-websocket (@zeyla) c:a5aa2a9
- [misc.] Update to Rust 2018 (@Lakelezz) c:21518c8
- [http/model/all] Remove global Cache and HTTP (@Lakelezz) c:712cfa5 c:3f0ea69
- [client] Change the
Context::data
field to use anRwLock
(@Erk-) c:661d778 - [cache] Pass old Message to
message_update
(@Mishio595) c:40bf272 - [framework] Check for Ownership in Help System (@Lakelezz) c:fa0376c
- [framework] Improve Help Consistency (@Lakelezz) c:51b48f4
- [misc.] Adhere to Rust 2018's idioms (@Lakelezz) c:5d6dc37
- [client] Add different
Context::new
s based on feature-set. (@Lakelezz) c:625b764 - [framework] Remodel
Args
's API (@acdenisSK) c:c472ddd - [framework] Rewrite the framework to attributes (@acdenisSK) c:cc81e47
- [framework] Handle Sub-Groups in the Help-System (@Lakelezz) c:9b591ec
- [voice] Fewer ffprobe calls when playing audio through ffmpeg (@FelixMcFelix) c:5dff7eb
- [voice] Optional impls and additional events for AudioReceiver (@FelixMcFelix) c:d955df4
- [voice] ClientConnect message handling (@FelixMcFelix) c:fa11a30
- [client] Pass the old voice state if the cache is enabled (@andreasots) c:bd45e42
- [http] Specify Header's Content Length as
0
(@eatsfoobars) c:a713b40 - [voice] Switch to
audiopus
(@Lakelezz) c:4af7a98 - [model] Make
enum
s non-exhaustive (@Lakelezz) c:9cc8816 - [http] Make the HttpError Send+Sync (@Erk-) c:6cfc0e1
- [framework] Update
on_mention
to take aUserId
(@Celti) c:d995fa0 - [utils] Simplify
from_rgb
, turn some of Colour's functions toconst
. (@hyarsan) c:c149e36
Fixed
- Fix ActivityFlags/ActivityTimestamps/ActivityParty deserialization (@zeyla) c:0a77330 c:d01eeae
- Fix
MessageBuilder
's doctests (@Flat) c:a3477a2