Releases: serenity-rs/serenity
v0.4.1
This release contains bugfixes and some newly added or newly exposed
functionality.
Thanks to the following for their contributions this release:
Added
- [general] Replace Vec parameters by
IntoIterator
(@ftriquet)c:55167c3 - [general] Replace slice parameters by
IntoIterator
(@ftriquet) c:022e35d - [model] Add
Guild::members_starting_with
(@Lakelezz) c:b3aa441 - [model] Add
Guild::members_containing
(@Lakelezz) c:1b167b5 - [model]
impl<'a> BanOptions for &'a str
(@acdenisSK) c:cf40386 - [model] Derive
Default
onCurrentUser
and IDs (@acdenisSK) c:09a8a44 - [client] Add a configurable, shard-shared threadpool (@zeyla) c:d7621aa,
c:8109619 - [model] Add
Guild::members_username_containing, members_nick_containing
(@Lakelezz) c:002ce3a - [framework] Add an iterator for
Args
(@acdenisSK) c:0ed1972 - [framework] Make
has_all_requirements
public (@Lakelezz) c:08d390c - [framework] Make default help messages list help for aliases (@Lakelezz)
c:0d1c0f1
Fixed
- [model] Use
request_client!
for attachment downloading (@lolzballs)
c:71f709d - [client] Fix client no-framework compilation (@zeyla) c:1d4ecb2
- [client] Fix client shards not filling (@zeyla) c:86d8bdd
- [model] Fix
User::tag
andCurrentUser::tag
discrim output (@zeyla)
c:6b9dcf5 - [framework] Modify
initialized
method purpose (@acdenisSK) c:05f158f - [framework] Make command Error string public (@acdenisSK) c:917dd30
- [client, gateway] Improve shard logic (@acdenisSK, @zeyla) c:683691f,
c:7befcd5 - [gateway] Reset shard heartbeat state on resume (@zeyla) c:c98cae4
- [general] Fix font-height and soften the logo (@Lakelezz) c:3b2c246
Misc.
- [client, gateway] Improve shard and shard runner logging (@zeyla)
c:21e194b to_owned
->to_string
(@acdenisSK) c:1bf4d9c- [general] Fix most clippy warnings (@Roughsketch) c:7945094
- [framework] Add some docs to
Args
(@acdenisSK) c:8572943 - [examples] Add
env_logger
bot example c:0df77b9 - [general] Fix clippy lints (@zeyla) c:483b069
- [model] Optimize
Member::roles
(@hsiW) c:8565fa2 - [general] Internally use a
try_opt!
macro (@hsiW) c:9b0c053 - [general] Feature-flag extern crates behind their name (@zeyla) c:11b85ca
v0.4.0
This release contains a lot of added functionality, minor-scale rewrites,
bugfixes, documentation work, and the beginning of a rewrite to use the tokio
ecosystem.
The release was delayed due to a [fairly majour bug][rust-websocket:issue:137]
in rust-websocket that we have forked over to temporarily fix.
This release was lead in development by [@acdenisSK].
Thanks to the following for their contributions this release:
- [@acdenisSK]
- [@Arcterus]
- [@Bond-009]
- [@blaenk]
- [@hsiW]
- [@imnotbad]
- [@joek13]
- [@Lakelezz]
- [@Roughsketch]
- [@xentec]
- [@zeyla]
Upgrade Path
Per commits [c:af1061b], [c:cdedf36], and [c:aa307b1], Direct Messaging other
bot users is now disallowed by the API. To fix this, simply don't do it.
Per commit [c:ebc4e51], deprecated functions were finally removed. The following
can simply have their usage renamed:
Cache::get_channel
-->Cache::channel
Cache::get_guild
-->Cache::guild
Cache::get_guild_channel
-->Cache::guild_channel
Cache::get_member
-->Cache::member
Cache::get_private_channel
-->Cache::private_channel
Cache::get_role
-->Cache::role
Cache::get_user
-->Cache::user
ChannelId::get_invites
-->ChannelId::invites
ChannelId::get_message
-->ChannelId::message
ChannelId::get_messages
-->ChannelId::messages
ChannelId::get_reaction_users
-->ChannelId::get_reaction_users
ChannelId::get_webhooks
-->ChannelId::webhooks
Channel::get_message
-->Channel::message
Channel::get_messages
-->Channel::messages
Channel::get_reaction_users
-->Channel::reaction_users
Client::login_bot
-->Client::new
Client::login
-->Client::new
Colour::get_b
-->Colour::b
Colour::get_g
-->Colour::g
Colour::get_r
-->Colour::r
Colour::get_tuple
-->Colour::tuple
CurrentUser::distinct
-->CurrentUser::tag
Group::get_message
-->Group::message
Group::get_messages
-->Group::messages
Group::get_reaction_users
-->Group::reaction_users
Guild::get_bans
-->Guild::bans
Guild::get_channels
-->Guild::channels
Guild::get_emoji
-->Guild::emoji
Guild::get_emojis
-->Guild::emojis
Guild::get_integrations
-->Guild::integrations
Guild::get_invites
-->Guild::invites
Guild::get_member
-->Guild::member
Guild::get_members
-->Guild::members
Guild::get_member_named
-->Guild::member_named
Guild::get_prune_count
-->Guild::prune_count
Guild::get_webhooks
-->Guild::webhooks
GuildId::get_bans
-->GuildId::bans
GuildId::get_channels
-->GuildId::channels
GuildId::get_emoji
-->GuildId::emoji
GuildId::get_emojis
-->GuildId::emojis
GuildId::get_integrations
-->GuildId::integrations
GuildId::get_invites
-->GuildId::invites
GuildId::get_member
-->GuildId::member
GuildId::get_members
-->GuildId::members
GuildId::get_prune_count
-->GuildId::prune_count
GuildId::get_webhooks
-->GuildId::webhooks
Message::get_reaction_users
-->Message::reaction_users
PartialGuild::get_bans
-->PartialGuild::bans
PartialGuild::get_channels
-->PartialGuild::channels
PartialGuild::get_emoji
-->PartialGuild::emoji
PartialGuild::get_emojis
-->PartialGuild::emojis
PartialGuild::get_integrations
-->PartialGuild::integrations
PartialGuild::get_invites
-->PartialGuild::invites
PartialGuild::get_member
-->PartialGuild::member
PartialGuild::get_members
-->PartialGuild::members
PartialGuild::get_prune_count
-->PartialGuild::prune_count
PartialGuild::get_webhooks
-->PartialGuild::webhooks
PrivateChannel::get_message
-->PrivateChannel::message
PrivateChannel::get_messages
-->PrivateChannel::messages
PrivateChannel::get_reaction_users
-->PrivateChannel::reaction_users
Role::edit_role
-->Role::edit
User::distinct
-->User::tag
http::send_file
has been replaced by http::send_files
. Instead of using http::send_file
like so:
use serde_json::Map;
use serenity::http;
use serenity::model::ChannelId;
use std::fs::File;
let channel_id = ChannelId(253635665344987136);
let filename = "mr-sakamoto.png";
let file = File::open(&format!("./img/{}", filename))?;
let map = Map::<String, Value>::new();
http::send_file(channel_id, file, filename, map)?;
Instead send an attachment of files, such as:
use serde_json::Map;
use serenity::http;
use serenity::model::ChannelId;
use std::fs::File;
let channel_id = ChannelId(253635665344987136);
let files = vec![
(File::open(&format!("./img/{}", filename))?, filename),
];
let map = Map::<String, Value>::new();
http::send_files(channel_id, files, map)?;
Similar logic can be applied to shortcut methods which have been removed,
namely:
Channel::send_file
(instead useChannel::send_files
)ChannelId::send_file
(instead useChannelId::send_files
)Group::send_file
(instead useGroup::send_files
)GuildChannel::send_file
(instead useGuildChannel::send_files
)PrivateChannel::send_file
(instead usePrivateChannel::send_files
)
Instead of using the now-removed Channel::delete_messages
and
Channel::delete_permission
, use the inner channel's method:
use serenity::model::{Channel, ChannelId};
let channel = ChannelId(253635665344987136).get()?;
let message_ids = vec![
MessageId(359845483356749825),
MessageId(359854838403694592),
];
if let Channel::Guild(c) = channel {
c.delete_messages(&message_ids)?;
}
Similar logic can be applied to Channel::delete_permission
.
Member::find_guild
ended up being only a shortcut to the Member::guild_id
structfield. Instead of calling the find_guild
method like
member.find_guild()
, instead access the structfield directly via
member.guild_id
.
The model::permissions::{general, text, voice}
methods have been removed, as
they ended up being shortcuts to the model::permissions::PRESET_GENERAL
,
model::permissions::PRESET_TEXT
, and model::permissions::PRESET_VOICE
constants, respectively.
Per commit [c:ea432af], event handling is now done via implementing a trait.
Instead of passing functions to the client directly like:
use serenity::Client;
use std::env;
let mut client = Client::new(env::var("DISCORD_TOKEN")?);
client.on_message(|ctx, msg| {
// code
});
Instead implement the new EventHandler trait:
use serenity::client::{Client, Context, EventHandler};
use serenity::model::Message;
struct Handler;
impl EventHandler for Handler {
fn on_message(&self, ctx: Context, msg: Message) {
// code
}
}
let client = Client::new(env::var("DISCORD_TOKEN")?);
Per commit [c:4f2e47f], the deprecated ext
module (which has recently only
been a series of re-exports for the cache
, framework
, and voice
modules)
was removed. Instead of using serenity::ext::cache
for example, use
serenity::cache
.
Per commit [c:878684f], due to the concept of default channels being changed,
GuildId::as_channel_id
has been deprecated due to the fact that the ID of the
default channel of a guild will no longer necessarily be the same as the guild's
ID.
If you require this same exact functionality (the GuildId
as a ChannelId
),
rewrite your code from:
use serenity::model::GuildId;
let channel_id = GuildId(81384788765712384).as_channel_id();
to:
use serenity::model::{ChannelId, GuildId};
let guild_id = GuildId(81384788765712384);
let channel_id = ChannelId(guild_id.0);
Per commits [c:2b053ea], [c:8cc2300], [c:8e29694], and [c:948b27c], custom
frameworks can now be implemented, meaning that a built implementation is now
passed instead of a base framework being provided and mutated. To use the old
framework, modify code from:
use serenity::Client;
use std::env;
let mut client = Client::new(&env::var("DISCORD_TOKEN")?);
client.with_framework(|f| f
// method calls to mutate framework here
);
to the new style:
use serenity::client::{Client, EventHandler};
use serenity::framework::standard::StandardFramework;
use std::env;
struct Handler;
impl EventHandler for Handler { }
let mut client = Client::new(&env::var("DISCORD_TOKEN")?, Handler);
client.with_framework(StandardFramework::new()
// method calls here to mutate framework here
);
Per commit [c:fc9eba3d], if you were pattern matching on the
serenity::framework::DispatchError::CheckFailed
variant, instead either use or
ignore the matched data by rewriting code from:
use serenity::framework::DispatchError;
// Code to begin dispatch error handling here.
match dispatch_error {
DispatchError::CheckFailed => {
// Handle operation here.
},
// Other variants.
}
to:
// The standard implementation is now in a "standard" framework module, but
// that's unrelated.
use serenity::framework::standard::DispatchError;
match dispatch_error {
DispatchError::CheckFailed(_) => {
// Handle operation here.
},
// Other variants.
}
Per commits [c:45d72ef], [c:03b6d78], and [c:d35d719], the framework's
command!
macro no longer parses arguments' types for you. You are now given an
Args
struct that you can retrieve arguments from and parse from to a requested
type that implements FromStr
.
For example, a simple sum function that looked like:
#[macro_use] extern crate serenity;
command!(sum(_ctx, msg, _args, x: i64, y: i64) {
let _ = msg.reply(&format!("Result: {}", x + y));
});
Now looks like:
use serenity::client::Context;
use serenity::framework::standard::Args;
use s...
v0.3.0
This release contains a number of added methods, fixes, deprecations, and
documentation improvements. It brings a module restructure and an upgrade to
rust-websocket v0.20, hyper v0.10, and switching to native-tls
, meaning
using an up-to-date rust-openssl v0.9 on Linux, schannel on Windows, and
Secure Transport on Mac. The long-standing issue #56 was closed.
Thanks to the following for their contributions this release:
Upgrade Path
Invite retrieval functions now accept a stats
argument. If you don't need
stats, just pass false
.
ChannelId::create_permission
and GuildChannel::create_permission
now accept
a reference, as they do not need to own the overwrite.
The deprecated GuildChannel
methods (get_invites
, get_message
,
get_messages
, get_reaction_users
, get_webhooks
) have been removed. Use
their equivalents without the get_
prefix.
The send_file
functions have been deprecated. Use send_files
instead by
passing a Vec.
CurrentUser::distinct
and User::distinct
have been deprecated. Instead use
CurrentUser::tag
and User::tag
.
User::get
has been deprecated. Instead, use UserId::get
.
Role::edit_role
has been deprecated, renaming it to Role::edit
.
time
has been removed as a direct dependency, moving to chrono
.
Public-facing fields that return time::Timespec
or were a String in ISO-3339
format are now chrono::DateTime<UTC>
s. Instead use its methods for what was
being done with the Timespec
s or strings.
User::direct_message
and User::dm
now accept a builder to allow for more
complete, yet simple use out of the methods. Instead of passing a &str
, use
the provided builder:
// old
user.dm("hello")?;
// new
user.dm(|m| m.content("hello"))?;
Client::login
has been deprecated. Instead use Client::new
:
use serenity::Client;
use std::env;
// old
let client = Client::login(&env::var("DISCORD_TOKEN")?);
// new
let client = Client::new(&env::var("DISCORD_TOKEN")?);
Member::guild_id
is now no longer an Option<GuildId>
-- just a GuildId
.
Since this is now always present, Member::find_guild
has been deprecated since
the cache now never searches the cache for the guild ID.
The deprecated GuildChannel
methods get_invites
, get_message
,
get_messages
, get_reaction_users
, and get_webhooks
have been removed. Use
their alternatives, such as GuildChannel::invites
, instead.
Added
- Add support for retrieving invites with counts (@hsiW) [c:302d771]
- Handle message type 7 (@fwrs) [c:8f88c6b]
- Add
GuildChannel::permissions_for
[c:6502ded] - Add
Invite::url()
,RichInvite::url()
[c:3062981] - Reasonable derive Debug on all items [c:9dae9e6]
- Add more examples and improve others [c:8c0aeac]
- Support adding reactions when creating message (@acdenisSK) [c:77b5b48]
- Add
VerificationLevel::Higher
[c:7dbae6b] - Add
CurrentUser::invite_url
(@Roughsketch, @Flat) [c:e033ff3],
c:0b95db9 impl From<char> for ReactionType
[c:2afab7c]- Implement multiple attachments (@Flat) [c:46b79dd]
- Add
_line
+_line_safe
methods toMessageBuilder
(@Roughsketch)
[c:543b604] - Add docs for
CurrentUser
(@Roughsketch) [c:921f7f4] - Add cache docs (@Roughsketch) [c:d367a70]
- Add docs and tests for framework (@Roughsketch) [c:4267bdb]
- Add
Content
forMessageBuilder
(@eLunate) c:060b06e - Include more info on ratelimiting debugs [c:d37461b]
- Add
User::refresh
[c:8c04d31] - Add some model docs (@Roughsketch) [c:c00f349]
- Add
Message::channel()
c:063a52f - Add
CurrentUser::default_avatar_url
[c:2d09152] - Add
CurrentUser::face()
,User::face()
[c:d033909] - Deserialize embed footers [c:e92b667]
- Add
Member::permissions
[c:39a28d3] (@acdenisSK) - Add
wait
parameter tohttp::execute_webhook
[c:dc73d1a]
Fixed
- Don't skip
@everyone
role when checking channel overwrites (@Roughsketch)
[c:b468cbf] - Allow
unreachable_code
lint incommand!
macro (@Flat) [c:eb43b9c] - Fix incorrect attempted
send_file
deserialization c:0102706 - Fix ratelimits causing 429s in certain situations [c:f695174]
- Check last heartbeat acknowledged in heartbeater [c:ec9b1c7]
- Make client join shards and return [c:175d3a3]
- Make client starts return an error [c:858bbf2]
- Ws read/write timeout after 90s to avoid infinite blocking [c:1700a4a]
- Fix negative nonces failing to deserialize [c:d0b64cd]
- Use HTTPS Connector with remaining HTTP functions c:0d218e0 (@Roughsketch)
Changed
- Restructure modules [c:9969be6]
- Change
create_permission
to take a reference [c:aea9885] - Remove deprecated
GuildChannel
methods [c:ab7f113] Guild::create_channel
doesn't require mutability [c:494cc50]- Deprecate
*User::distinct
, add*User::tag
[c:6579b1f] - Deprecate
User::get
[c:afc571f] - Deprecate
Role::edit_role
, addRole::edit
[c:c00f349] - Switch to chrono [c:990e611]
- Make
User::direct_message
/User::dm
accept a builder c:11a02db - Deprecate
Client::login
, addClient::new
[c:7990381] - Make
Member::guild_id
non-optional [c:b4bd771] - Remove
Context::channel_id
andContext::queue
[c:8b504ad] - Make the framework's
dynamic_prefix
accept an&Message
[c:2845681] - Deprecate
Channel::delete_messages
,Channel::delete_permission
[c:7fc49d8] - Make
Message::nonce
aserde_json::Value
[c:c832009]
Misc.
- Remove deprecated
login_bot
usage from docs (@hsiW) [c:ae395f4] - Fix call to
VoiceManager::join
in example 06 (@barzamin) [c:6853daf] - Sort default help by group/command names (@Roughsketch) [c:93416cd]
- Move
CreateGroup
docs to the struct [c:71f3dbb] - Don't create group in help if no commands to show (@Roughsketch) [c:4f5fbb5]
- Move user avatar method logic out [c:8360f32]
- Upgrade rust-websocket and hyper, switch to native-tls [c:8f8a059]
- Fix broken links in README [c:51c15d0]
- Remove unused
cookie
dependency [c:92f4ec2] - Switch from
#[doc(hidden)]
topub(crate)
[c:32e07e4] (@acdenisSK) - Re-export all errors from the prelude [c:db0f025]
- Rework shard logic and shard handling [c:601704a]
Module rewrites, optimizations, bugfixes, & more
This is a very large release with a number of rewritten components. The cache
has been rewritten to make use of memory more efficiently, the models directory
has been re-organized, structures are now deserialized via serde and
serde_derive
- instead of the custom decoding build script we had - with a
number of bugfixes and other various changes and additions.
Thanks to the following for their contributions this release:
- @acdenisSK
- @Flat
- @fwrs
- @hsiW
- @Roughsketch
- @sschroe
Upgrade Path
Replace uses of ext::cache::ChannelRef
with model::Channel
.
The following ext::cache::Cache
method signatures are now encased in
Arc<RwLock>
s and should be handled appropriately:
call
channel
guild
guild_channel
group
member
role
user
Additionally, GuildId::find
and UserId::find
now return
Option<Arc<RwLock>>
s.
Member::display_name
now returns a Cow<String>
instead of a &str
.
client::Context
has had most of its methods removed. The methods were mostly
a copy of those on ChannelId
. Upgrade by instead calling methods on
ChannelId
:
command!(foo(ctx) {
let _ = ctx.say("hello");
});
// is now written as:
command!(bar(_ctx, msg) {
let _ = msg.channel_id.say("hello");
});
CreateMessage::nonce
has been removed. Instead, simply do not provide a nonce.
ChannelId::edit_message
now has an argument signature of:
&self, message_id: M, f: F
where F: FnOnce(CreateMessage) -> CreateMessage, M: Into<MessageId>
instead of
&self, message_id: M, text: &str, f: F
where F: FnOnce(CreateEmbed) -> CreateEmbed, M: Into<MessageId>
To account for this change, modify code like so:
channel_id.edit_message(message_id, "new content", |e| e);
// now:
channel_id.edit_message(message_id, |m| m.content("new content"));
Message::edit
has also had an argument signature updated to:
&mut self, f: F where F: FnOnce(CreateMessage) -> CreateMessage
from:
&mut self, new_content: &str, embed: F where F: FnOnce(CreateEmbed) -> CreateEmbed
To account for this change, modify code like so:
message.edit("new content", |e| e.description("test"));
// now:
message.edit(|m| m.content("new content").embed(|e| e.description("test")));
client::rest::accept_invite
, Invite::accept
, and RichInvite::accept
have
been removed. Instead, do not attempt this, as they were userbot functions.
Selfbot support has been completely removed. Review the
[commit message][c:d9118c0] for the long list of details.
Group calls and guild sync have [also been removed][c:c74cc15]. Read the commit
message for all the details.
Instead of defining multiple separate error messages for command framework
message dispatches, match the dispatch error in a single method:
// old code:
client.with_framework(|f| f
.configure(|c| c
.command_disabled_message("The command `%command%` was disabled")
.blocked_guild_message("The owner of this guild has been blocked")
.invalid_permission_message("You don't have permission to use this command")));
// new code:
client.with_framework(|f| f.on_dispatch_error(|_, msg, err| {
match err {
DispatchError::CommandDisabled(command_name) => {
let _ = msg.channel_id.say(&format!("The command `{}` was disabled", command_name));
},
DispatchError::BlockedGuild => {
// this change also allows for more intelligent error messages:
if let Some(guild) = msg.guild() {
let owner_id = guild.read().unwrap().owner_id;
if let Some(user) = CACHE.read().unwrap().user(owner_id) {
let c = format!("The owner - {} - has been blocked", user.name);
let _ = msg.channel_id.say(&c);
return;
}
}
let _ = msg.channel_id.say("The owner of this guild has been blocked");
},
DispatchError::LackOfPermissions(_) => {
let _ = msg.channel_id.say("You don't have permission to use this command");
},
}
}));
All functions prefixed with get_
have had the prefix removed. For example,
Guild::get_webhooks()
is now Guild::webhooks()
.
Instead of using model::permissions::general()
, model::permissions::text()
,
and model::permissions::voice()
, use
model::permissions::{PRESET_GENERAL, PRESET_TEXT, PRESET_VOICE}
.
Added
- Add
say
method toGroup
,GuildChannel
,PrivateChannel
[c:a0bb306] - Add missing
send_file
/send_message
impls [c:bad9ac3] - Add
Message::guild
[c:9ef5522] - Add Shard Id helpers c:1561f9e
- Implement
From<&str> for ReactionType
[c:e7110ad] - Check for embed lengths on message sends [c:e1079e9]
- Add
is_nsfw
check to channels [c:9268f9c] - Add missing
Member::kick
helper [c:83b1d96] - Derive
Eq
,Hash
,PartialEq
onReactionType
[c:86a4e00] (@acdenisSK)
Fixed
- Handle unsuccessful responses before decoding [c:7e254c5]
- Uniquely ratelimit message deletions c:01f6872
- Fix Member methods due to variant
joined_at
values [c:cd914f5] - Fix deadlock on channel create event for DMs [c:6b0b9b2] (@sschroe)
- Default to using
[0, 1]
shards [c:f0d1157] - Fix ratelimiting for
Route::None
routes [c:5bf6c2d] - Fix guild leaving result [c:ae352ea]
- Fix permissions when sending to DMs or groups c:404a089 (@acdenisSK)
- Check if message starts with
dynamic_prefix
result [c:9ec05e7] (@Roughsketch) - Trim content before parsing framework args [c:e6712c9] (@Roughsketch)
Changed
- Optimize caching c:0c9ec37
- Remove most
Context
methods [c:585af23] - Remove sending message nonces [c:9c04a19]
- Standardize message editing methods c:3c7c575
- Remove invite accepting [c:e4b484f]
- Remove selfbot support [c:d9118c0] [c:c74cc15]
- Switch to using serde for deserialization [c:f6b27eb]
- Update the ways errors are handled in dispatch c:31aae7d (@fwrs)
- Deprecate methods prefixed with
get_
c:3f03f9a - Framework help commands now accept a slice of args [c:ff4437a]
- Make
User.discriminator
au16
c:0f41ffc - Use constants for preset permissions [c:70d4e75]
Misc.
- Make logo more better [c:6e11a10] (@Flat)
- Fix incorrect cache example [c:b96f85c]
- Rework the models directory [c:9114963]
- Change permission values to byte literals [c:c8536c1]
- Fix example in README [c:d4fc8b6]
rustc nightly fix & optimizations
This is a release to fix broken nightly builds, due to a change in how rustc
handles lifetimes, with a few performance optimizations and other fixes.
Upgrade Path
For Group::send_message
, PrivateChannel::send_message
,
and GuildChannel::send_message
, instead of passing in only a &str
of
content, use a CreateMessage
builder:
// assuming a `channel` is bound
// old signature:
channel.send_message("hello");
// new signature:
channel.send_message(|m| m.content("hello"));
Instead of calling message_id.get_reaction_users
and passing in a ChannelId
,
call channel_id.get_reaction_users
and pass in the MessageId
. Note that the
latter already existed.
// assuming `channel_id`, `message_id`, and `reaction_type` are bound
// removed method:
message_id.get_reaction_users(channel_id, reaction_type, Some(10), None);
// alternative method:
channel_id.get_reaction_users(message_id, reaction_type, Some(10), None);
Added
- Register the
status
user setting for user accounts (e.g. online, invisible)
c:0b9bf91 - Expose and document ratelimiting structures c:eb09f2d
- Add method to
EditGuild
to transfer ownership c:f00e165
Fixed
- Fix potential unreachable pattern warning in
command!
macro c:97f9bd1 - Fix value of 'browser' in shard identify c:4cf8338
- Remove lifetime on Search builder c:6f33a35
Changed
Misc.
- Avoid re-requesting the gateway URL when autosharding (optimization)
c:e891ebe - Avoid cloning on non-framework message create events (opt.) c:b7cbf75
- Avoid cloning the context on event dispatches (opt.) c:5ee5fef
- Optimize presence update for current user in cache (opt.) c:9392f61
- Make
GLOBAL
ratelimit mutex a unit (opt.) c:55ccaca - Resume when restarting WS sender/receiver c:04cfaa9
OOP and general stuff
This is a general release for pretty much everything, from new features to
bugfixes to a switch to a more OOP style. The current minimum supported version
is rustc 1.13+.
The next release will be v0.2.0, which will feature serde codegen support along
with a rewrite of the framework. It will be a more modularized version of the
library. v0.2.0 will require rustc 1.15+, due to the stabilization of Macros
1.1.
Thanks to the following for contributions this release:
Two of the major highlights of this release are that the broken pipe issue has
been fixed, and the library is more OOP now and therefore no longer relies on
the Context
to get stuff done. The methods
feature flag has been removed.
Added
- the
voice
feature no longer requires thecache
feature to be enabled
c:7b45f16 - the
framework
feature no longer requires thecache
feature to be enabled
c:86cd00f Guild
,InviteGuild
, andPartialGuild
now havesplash_url
methods
c:d58c544- Expose
Message::webhook_id
for messages sent via webhooks (@fwrs)
c:a2cbeb6 - Framework: add option to ignore webhooks or DMs (@fwrs) c:8e2c052
- Added documentation for creating embed timestamps (@foxbot) c:66546d3
- Allow
time::Tm
to be passed into the embed timestamp field, in addition to
a direct string c:b001234 - Add
Client::on_message()
example (@indiv0) c:bcb70e8 - Support webp/gif avatars/icons in URL methods c:ab778f8
- Update current user presence in cache on set c:5b275fc
- Add
CurrentUser
/User::static_avatar_url()
methods to generate webp URLs
c:c36841d - Command (batch) alias support (@fwrs) c:f96b6cc
- Command example field for help command (@fwrs) c:f96b6cc
- Added "Meibi Pink" to the
Colour
struct (@hsiW) c:2cb607d - Register support for
4011
code (too many shards) (@SunDwarf) c:93f3c60 - Added "Rohrkatze Blue" to the
Colour
struct (@bippum) c:345e140 - Add
User::default_avatar_url()
c:e85e901 - Add
Message::content_safe()
to avoid@everyone
/@here
s (@fwrs)
c:e5a83dd - Add
Member::distinct()
,User::distinct()
(@fwrs) c:e5a83dd - Document that messages can't be older than 14 days when bulk deleting
(@fwrs) c:0a2f5ab - Add shard latency tracking (
stolenborrowed from brayzure/Eris)
c:096b0f5 - Add guild chunking c:3ca7ad9
Fixes
User::avatar_url
no longer mentions the user in the generated URL
c:0708ccf- Framework:
owners_only
check now functions only if the author of a message
is an owner (@fwrs) c:6355288 - Framework: fix command cooldown timer (would always say to wait
i64::MAX
seconds) c:fafa363 - Framework: the
before
closure is now properly run when a message is sent by
the owner c:760a47a CurrentApplicationInfo
now properly decodes due toflags
no longer being
sent c:2a743ce- Fix
Message::delete()
permission check c:4229034 - Framework: properly split messages on character boundary limits; aka thanks
Unicode c:c01f238 - Remove need to import Context/Message in command macros (@acdenisSK)
c:abd22d2 - Fix a ton of gateway stuff [c:94fc85b], c:f894cfd, c:f894cfd
- Specify
command!
macro signature as returningstd::result::Result
c:e9aae9c - Fix dependency description in example 06 (@DeltaEvo) c:92309b2
- Return a
User
fromrest::get_user
-- not aCurrentUser
c:f57a187 - Fix shards always booting at index 0 c:83b29d5
- Wait 5 seconds between shard boots to avoid session invalidations c:fb4d411
- Use CDN for default avatars c:69ec62a
- Fix
Resumed
event payload decoding c:c2e8b69 - Fix
CurrentApplicationInfo
decoding withoutrpc_origins
c:38db32e - Reboot shard on broken pipe; fixes a lot of gateway problems c:76f9095
- Make
rest::execute_webhook
be a POST c:c050c59
Changed
- Framework: argument number is now displayed on parsing error (@fwrs)
c:fb07751 - Id display formatters use the direct u64 instead of mentioning;
format!("{}", UserId(7))
will format into"7"
instead of"<@7>"
c:933ee89 - Default the framework's
use_quotes
for quote parsing tofalse
(wastrue
)
c:38a484d - The
CreateEmbed
builder now has directimage
andthumbnail
methods
instead of one-method builders c:68c473d - Accept
u64
shard counts to allow using more than 255 shards (instead of
u8
s) c:ada07fa - Remove user logout endpoint c:70bf22a
- Don't abuse unicode for message content sanitization (@fwrs) c:2b237e7
- Change
Colour
struct to be a tuplestruct c:a8acd61 - Make a single POST on guild role create c:147cf01
- Switch to a mostly-fully OOP approach c:651c618
- Rename
webhooks
methods toget_webhooks
(eg:GuildChannel::webhooks()
-->GuildChannel::get_webhooks()
)
[c:e8a9086](e8a9086...