Nostrum Versions Save

Elixir Discord Library

v0.6.1

1 year ago

nostrum 0.6.1

image

Welcome to nostrum 0.6.1, a small bugfix release addressing issues with token validation and typespecs.

Thanks to @Th3-M4jor and @cedeno for their contributions to this release!

Bugfixes

  • Support non-padded base64 user ID in Discord bot tokens
  • Fix dialyzer issues related to webhook functions

v0.6.0

1 year ago

nostrum_06_cropped

Welcome to nostrum 0.6.0, bringing you message content intents, API v10, voice improvements, new permissions, and more!

A huge thanks to @Th3-M4jor, @BrandtHill and @daskycodes for their contributions to this release!

Breaking changes

  • If your bot relies on message content, you will need to add :message_content in your :gateway_intents configuration setting.
  • Voice listening now automatically parses RTP and Opus. You can pass false as the third argument to listen/2-3 to reuse the previous behaviour.
  • The :manage_emojis permission was renamed to :manage_emojis_and_stickers

Functionality

  • API v10
    • Added the :message_content intent
    • Added the following permissions:
      • Guild
        • :view_guild_insights
        • :use_application_commands
        • :moderate_members
      • Text
        • :use_external_stickers
      • Voice
        • :stream
        • :request_to_speak
        • :manage_events
        • :use_embedded_activities
  • Interactions
    • Add the :locale and :guild_locale fields
  • Voice
    • Add asynchronous listening to voice packet events via Nostrum.Voice.start_listen_async/1
    • Add a ssrc map (see t:Nostrum.Voice.VoiceWSState.ssrc_map/0 and Nostrum.Voice.get_ssrc_map/1 for details)
    • Automatic parsing of RTP and Opus (see breaking changes above)
    • Add a function to interleave silence within spaced RTP packets (see Nostrum.Voice.pad_opus/1 for details)
    • Track the last played URL for a guild, see Nostrum.Voice.get_current_url/1
    • Add plenty of types
  • Caching
    • Add a NoOp guild cache for effectively disabling the guild cache
  • Garbage collect ratelimiter buckets that have a reset time more than 1 hour ago
  • Add Nostrum.Token for verifying Discord Bot tokens
  • Rework message handling with attachments (the multipart-generating code)
  • Allow mime version 1 and 2

Bugfixes

  • Voice
    • Fix a bug with generating ogg pages with incorrect page_segments value
    • Properly skip over RTP header extension
    • Safely close ports on teardown
    • Fix bug where playing new audio immediately after stopping one would sometimes result in rogue watchdog timer cancelling new audio
  • Fix ratelimiting of reaction and webhook API endpoints
  • Fix check_token/1 to work with newer token formats
  • Fix Message.to_url/1 breaking on numeric IDs
  • Fix an improper call to Util.cast in the Integration and Integration.Application structs
  • Handle unexpected nofin responses in the ratelimiter. Please report these cases

Documentation

  • Document required :message_content intent if relying on content for e.g. commands
  • Update the audio player example to use application commands
  • Correct a few typos in the Api module

v0.5.1

2 years ago

Introducing nostrum 0.5.1 "I don't pick favourites", named after Craig's favourite cat! The release brings support for threads, a decoder for incoming voice data, integration events, modal submit interactions, and a bunch more goodies!

A huge thanks to @Th3-M4jor, @BrandtHill, @frm and @kianmeng for their contributions to this release!

If you're using streamlink for voice streaming, you may need to update it to >= 3.0 for this release, in order for the stream URL feature to work properly.

Functionality

  • Threads
    • Added support for threads:
      • Added Nostrum.Api functions for working with threads
      • Add thread events in the consumer
      • Added struct definitions for thread events
  • Voice
    • Use streamlink directly for determining stream URLs
    • Add support for persisting playback across channels
    • Remove dependency to porcelain in favour of native ports
    • Add opus packet decoding, allowing to save received audio as .ogg files
  • Interactions
    • Add support for modal submit interactions and the associated text input type
  • Integrations
    • Expand stub integration events to proper types
    • Document integration events & cast them to event structs
  • Update to API v9

Documentation

  • Fix a bunch of typos

v0.5.0

2 years ago

Enter nostrum 0.5: Raw voice, fleshed-out application command support, pluggable caches, stickers, typed events, scheduled events, did someone say "switch websocket library again"?

Thanks to @jb3, @Th3-M4jor, @BrandtHill, @bdanklin, @RealVidy, and the many more people who contributed to the release with pull requests, bug reports, feature suggestions, or just by being part of the development channel. A full list of our contributors, minus the mention spam, is at the bottom. Finally, thanks for the author of this tag for turning what should have been a day project into a one and a half year long incursion.

Breaking changes

  • The following options for allowed_mentions have been renamed:
    • :user -> :users
    • {:user, list} -> {:users, list}
    • {:role, list} -> {:roles, list}
  • The type value for permission overwrites has changed:
    • "role" -> 0
    • "member" -> 1
  • Binary map keys coming from Discord that appear to be snowflakes will be parsed as integers to prevent inconsistencies in e.g. interaction data payloads
  • Parse datetimes to datetime objects instead of keeping raw strings
  • Require Elixir 1.11

Deprecations

  • The :file option for Nostrum.Api.execute_webhook/3-4 was renamed to :files and expects a list of files instead of a single file. :file will keep working for the time being, but you are advised to use :files instead.

Functionality

  • Application commands
    • Allow adding attachments to an interaction response
    • Support for retrieving and editing application command permissions
    • Add support for editing and deleting interaction responses
    • Add application command bulk overwrite support via Nostrum.Api.bulk_overwrite_global_application_commands/1-2 and Nostrum.Api.bulk_overwrite_guild_application_commands/2-3
    • Add bangified methods for interaction response functions
    • Add structs for building and responding to interactions and working with message components:
      • Nostrum.Struct.ApplicationCommand
      • Nostrum.Struct.ApplicationCommandInteractionDataResolved
      • Nostrum.Struct.Component
      • Nostrum.Struct.Component.ActionRow
      • Nostrum.Struct.Component.Button
      • Nostrum.Struct.Component.Option
      • Nostrum.Struct.Component.SelectMenu
      • Nostrum.Struct.Message.Component
    • Update the following structs relevant to building and responding to interactions:
      • Nostrum.Struct.ApplicationCommandInteractionData
      • Nostrum.Struct.ApplicationCommandInteractionDataOption
      • Nostrum.Struct.Interaction
      • Nostrum.Struct.Message
  • Miscellaneous
    • Allow for sending multiple files in a single message
    • Allow retrieval of a guild ban for a single user
    • Add sticker support via sticker attributes and Nostrum.Struct.Message.Sticker
    • Add support for specifying an audit log reason in Nostrum.Api.modify_guild_member/4
    • Add webhook message editing support via Nostrum.Api.edit_webhook_message/4
    • Add Nostrum.Struct.Guild.Member.top_role/2 for retrieving the topmost role of a member
    • Add Nostrum.Struct.Message.to_url/1 for retrieving a message link for a message
    • Move to Discord API V8 (both in the REST API and Gateway)
  • Channels
    • Add types for the following channel types:
      • News & store channels
      • Threads (public, private, news)
      • Stage voice channel
  • Documentation updates
    • Overhaul of channel documentation (see Nostrum.Struct.Channel), which now gives a great overview for the jungle of Discord's channel types
    • Document Nostrum.Struct.Message.type values
    • Fix all documentation build warnings
    • Move to ex_doc version 0.28
  • Pluggable caching
    • Customize the way nostrum caches objects from Discord
    • By default, nostrum will cache objects in ETS tables
      • For guilds, we previously used GenServers
    • See the "State" documentation page for more details
  • Typed events
    • The following events will now be returned in special structs:
      • CHANNEL_PINS_UPDATE
      • GUILD_BAN_ADD
      • GUILD_BAN_REMOVE
      • GUILD_INTEGRATIONS_UPDATE
      • MESSAGE_REACTION_ADD
      • MESSAGE_REACTION_REMOVE
      • MESSAGE_REACTION_REMOVE_ALL
      • MESSAGE_REACTION_REMOVE_EMOJI
      • READY
      • TYPING_START
      • VOICE_STATE_UPDATE
      • VOICE_SERVER_UPDATE
  • Voice
    • Support for streamlink for livestreaming audio
    • The new VOICE_READY event, fired when the bot is ready for sending audio in a voice channel
    • Lots of documentation changes
    • Add support for sending raw voice packets ("Bring Your Own Encoder")
    • New fine-tuning options for voice playback
      • Configure the start position
      • Configure the duration to play
      • Output volume configuration
      • Add support for applying filters to audio
      • Realtime switch (ffmpeg-specific) fine-tuning
    • New fine-tuning options for voice in general
      • Configure the timeout within which the bot must begin generating audio
      • Configure how many opus frames to send at a time while playing audio
      • Configure whether nostrum should automatically connect to voice websockets when joining voice channels
    • Remake session on errno 4006
    • Learn more about the changes on the "Voice" documentation page
  • Scheduled events
    • Add API methods for CRUD of scheduled events along with getting users subscribed to an event
    • Add the following gateway events:
      • GUILD_SCHEDULED_EVENT_CREATE
      • GUILD_SCHEDULED_EVENT_UPDATE
      • GUILD_SCHEDULED_EVENT_DELETE
      • GUILD_SCHEDULED_EVENT_USER_ADD
      • GUILD_SCHEDULED_EVENT_USER_REMOVE
    • Add the guild_scheduled_events intent

Usability

  • Dialyzer will now catch errors with missing parameters in Nostrum.Api.execute_webhook/3-4
  • num_shard: :auto is now used by default

Internals

  • We have switched websocket libraries again!
    • Just kidding. We have switched our HTTP client to :gun, which we already use for websocket, which reduced our dependency footprint.
    • If you see a HTTP multipart request containing KraigieNostrumCat_ as the boundary, that's us!
  • Dependency updates, ex_doc among others
  • Fail CI fast if one job fails

Contributors

Thanks to these wonderful folks who have contributed to this release:

  • Alex Hincu
  • Andris0
  • Awlexus
  • Bailey Dickens
  • Benjamin Danklin
  • Brandt Hill
  • Craig Dazey
  • Joe Banks
  • Johannes Christ
  • Khionu Sybiern
  • Kraigie
  • Michael Mitchell
  • PixeL
  • RealVidy
  • The Major
  • Vidy
  • panoramix360
  • wkrp

v0.4.5

3 years ago
  • Voice implemented d0decb57bf306fdf7e3f3cba9a5486da64130fb9
  • Gateway intents 60767eea628793afc728f52af8d1b558bac0813a

v0.4.1

4 years ago
  • Fixed heartbeat_ack not being reset when reconnecting, creating a loop of reconnecting and then disconnecting shortly after (d424c473972ce27c4e6cfc5318816d648ccb4ea3)

v0.4.0

4 years ago
  • Replaced websockex with gun to combat issue of bots being unable to start due to WS closing with error code 1000 (0e463424dbdd7203acb5a68d462bd9748706ae60)
  • Added proper struct for message delete gateway event (057934f57c01e2701f3bf2bba0a633b1620b8249)
  • Stopped using guild names as an atom for guild process naming (d0170367ac7134079319ac6d174da698596e0f24)
  • Added support for leaving/joining voice channels (4a6642df9fbfd9a9247e565ab3f4d8d1e6f6ed4f)

v0.3.2

5 years ago
  • Updated HTTPoison to v1.5 (954c6dff9e0cc96cbd28993edce8b01fd3047cec)
  • Renamed Nostrum.Struct.Snowflake to Nostrum.Snowflake (603da771b0171c71e49109dfb72f26a912037380)

v0.3.1

5 years ago
  • Locked websockex version (9164de52ed1cce7433a2af09313dc7800a6e9a97)