Skip to content

v0.3.0

Compare
Choose a tag to compare
released this 24 Jun 16:55
· 2725 commits to current since this release

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 Timespecs 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

Fixed

  • Don't skip @everyone role when checking channel overwrites (@Roughsketch)
    c:b468cbf
  • Allow unreachable_code lint in command! 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, add Role::edit c:c00f349
  • Switch to chrono c:990e611
  • Make User::direct_message/User::dm accept a builder c:11a02db
  • Deprecate Client::login, add Client::new c:7990381
  • Make Member::guild_id non-optional c:b4bd771
  • Remove Context::channel_id and Context::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 a serde_json::Value c:c832009

Misc.