- Fixed an error (caused by an undocumented API change) that would write a traceback to the console every time someone started typing in a channel invisible to the bot.
- The built-in logger has been somewhat redone.
- It now has a fancy mode, settable using
Discordrb::LOGGER.fancy = true/false
, that makes use of ANSI escape codes to prettify the log output. - It now supports more things than just
debug
, there's alsowarn
,error
,good
,info
,in
, andout
. - You now have finer control over what gets output, using
Discordrb::LOGGER.mode=
which accepts one of:debug
,:verbose
,:normal
,:quiet
,:silent
.
- It now has a fancy mode, settable using
- You can now log in with just a token by setting the email parameter to
:token
and the password to the token you want to log in with. - DCA playback now supports
DCA1
. - All data classes (now generalized using the
IDObject
mixin) have acreation_date
parameter that specifies when the object was created. Channel#mention
was added that mentions a channel analogous toUser#mention
.- The aliases
tag
anddiscord_tag
have been added to the discriminator because that's what Discord calls them now.
- A problem some users had where voice playback would leak FFmpeg processes has been fixed.
- The VWS internal thread now has a name in debug messages (
vws-i
) - Users' voice channels should now always be set if they are in one
Channel#send_message
andBot#send_message
now have an extratts
parameter (false by default) to specify whether the message should use TTS.
- Attempting to
p
a data class, especially aUser
orProfile
, should no longer lock up the interpreter due to very deep recursion. - Manual TTS using
API.send_message
will now work correctly.
- Added methods
Channel#text?
andChannel#voice?
to check a channel's type. - Frequently allocated strings have been turned into symbols or frozen constants, this should improve performance slightly.
VoiceBot#destroy
will now properly disconnect you and should no longer cause segfaults.- Fixed a bug where you couldn't set any settings on a role created using
Server#create_role
. - Fixed
Profile#avatar=
doing absolutely nothing.
- The server banlist can now be accessed more nicely using
Server#bans
. - Some abstractions for OAuth application creation were added -
bot.create_oauth_application
andbot.update_oauth_application
. See the docs about how to use them.
- The
bot
object can now be read from all events, not just from command ones. - You can now set the
filter_volume
on VoiceBot, which corresponds to the old way of doing volume handling, in case the new way is too slow for you.
- A
clear!
method was added to EventContainer that removes all events from it, so you can overwrite modules by defining them again. (It's unnecessary for CommandContainers because commands can never be duplicate.)
- The tokens will now be verified correctly when obtained from the cache. (I messed up last time)
- Events of the same type in different containers will now be merged correctly when including both containers.
- Got rid of the annoying
undefined method 'game' for nil:NilClass
error that sometimes occurred on startup. (It was harmless but now it's gone entirely)
bot.find
andbot.find_user
have had their fuzzy search feature removed because it only caused problems. If you still need it, you can copy the code from the repo's history. In addition,find
was renamed tofind_channel
but still exists as a (deprecated) alias.- The in-line documentation using Yard is now complete and can be accessed at RubyDoc. It's not quite polished yet and some things may be confusing, but it should be mostly usable.
- Events and commands can now be thoroughly modularized using a system I call 'containers'. (TODO: Add a tutorial here later)
- Support for the latest API changes:
Server.leave
does something different thanServer.delete
- The WebSocket connection now uses version 3 of the protocol
- Voice bots now support playing DCA files using the
play_dca
method. (TODO: Add a section to the voice tutorial) - The volume of a voice bot can now be changed during playback and not only for future playbacks.
- A
Channel.prune
method was added to quickly delete lots of messages from a channel. (It appears that this is something lots of bots do.) Server#members
is now aliased tousers
.- An attribute
Server#member_count
was added that is accurate even if chunked members have not been added yet. - An attribute
Server#large?
was added that is true if a server could possibly have an inaccurate list of members. - Some more specific error classes have been added to replace the RestClient generic ones.
- Quickly sending a message using the
event << 'text'
syntax now works in every type of message event, not just commands. - You can now set the bitrate of sent audio data using
bot.voice.encoder.bitrate = 64000
(seeEncoder#bitrate=
). Note that sent audio data will always be unaffected by voice channel bitrate settings, those only tell the client at what bitrate it should send. - A rate limiting feature was added to commands - you can define buckets using the
bucket
method and use them as a parameter forcommand
.- A
SimpleRateLimiter
class was also added if you want rate limiting independent from commands (e. g. for events)
- A
- Connecting to the WebSocket now uses an exponential falloff system so we don't spam Discord with requests anymore.
- Debug timestamps are now accurate to milliseconds.
- The token cacher will now detect whether a cached token has been invalidated due to a password change.
break
ing from an event or command will no longer spewLocalJumpError
s to the console.
- Fixed a problem that would cause an incompatibility with Ruby 2.1
- Fixed servers sometimes containing duplicate members
- The bot will now request the users that would previously be sent all in one READY packet in multiple chunks. This improves startup time slightly and ensures compatibility with the latest Discord change, but it also means that some users won't be in server members lists until a while after creation (usually a couple seconds at most).
- Fixed a bug that made the joining of servers using an invite impossible.
- Fixed a bug that prevented the banning of users over the API
- RbNaCl is now installed directly instead of the wrapper that also contains libsodium. This has the disadvantage that you will have to install libsodium manually but at least it's not broken on Windows anymore.
- It's now possible to prevent the
READY
packet from being printed in debug mode, runbot.suppress_ready_debug
once before thebot.run
to do it.
- Token cache files with invalid JSON syntax will no longer crash the bot at login.
- The inline documentation using YARD was greatly improved and is now mostly usable, at least for the data classes and voice classes. It's still not complete enough to be released on GitHub, but you can build it yourself using YARD.
- It's now possible to encrypt sent voice data using an optional parameter in
voice_connect
. The encryption uses RbNaCl's SecretBox and is enabled by default. - The new library comparison is now fully supported, barring voice receive and multi-send: (#39)
bot.invite
will create anInvite
object from a code containing information about it.server.move(user, channel)
will move a user to a different voice channel.- The events
bot.message_edit
andbot.message_delete
are now available for message editing and deletion. Note that Discord doesn't provide the content of edited/deleted messages, so you'll have to implement message caching yourself if you really need it. - The events
bot.user_ban
andbot.user_unban
are now available for users getting banned/unbanned from servers.
- A bot's name can now be sent using
bot.name=
. This data will be sent to Discord with the user-agent and it might be used for cool statistics in the future. - Discord server ownership transfer is now implemented using the writer
server.owner=
. (#41) CommandBot
s can now have command aliases by simply using an array of symbols as the command name.- A utility method
server.default_channel
was implemented that returns the default text channel of a server, usually called #general. (An aliasgeneral_channel
is available too.) - Tokens will no longer appear in debug output, so you're safe sending output logs to other people.
- A reader
server.owner
that returns the server's owner as aUser
was added. Previously, users had to manually get theUser
object usingbot.user
. - Most methods that accept IDs or data objects now also accept
Integer
s orString
s containing the IDs now. This is implemented by adding a methodresolve_id
to all objects that could potentially contain an ID. (Note that this change is not complete yet and I might have missed some methods.) (#40) - The writer
server.afk_channel_id=
is now deprecated as its functionality is now covered byserver.afk_channel=
. - A new reader
user.avatar_url
was added that returns the full image URL to a user's avatar. - To avoid confusion with
avatar_url
, the readeruser.avatar
was renamed toavatar_id
. (user.avatar
still exists but is now deprecated.) - Symbols are now used instead of strings as hash keys in all methods that send JSON data to somewhere. This might improve performance slightly.
- Fixed the reader
server.afk_channel_id
not containing a value sometimes. - An issue was fixed where attempting to create a
Server
object from a stub server that didn't contain any role data would cause an exception. - The
Invite
server
property will now be initialized directly from the invite data instead of the channel the invite is to, to prevent it beingnil
when the invite channel was stubbed. - The
inviter
of anInvite
will now benil
instead of causing an exception when it doesn't exist in the invite data.
- The
opus-ruby
andlevenshtein
dependencies are now optional - if you don't need them, it won't crash immediately (only when you try to use voice /find
with a threshold > 0, respectively)
- Voice volume can now be properly set when using avconv (#37, thanks @purintai)
websocket-client-simple
, which is required for voice, is now specified in the dependencies.
- Voice bot length adjustments are now configurable using
bot.voice.adjust_interval
andbot.voice.adjust_offset
(make sure the latter is less than the first, or no adjustment will be performed at all) - Length adjustments can now be made more smooth using
bot.voice.adjust_average
(true allows for more smooth adjustments, may improve stutteriness but might make it worse as well)
bot.voice_connect
can now use a channel ID directly.- A reader
bot.volume
now exists for the corresponding writer. - The attribute
bot.encoder.use_avconv
was added that makes the bot use avconv instead of ffmpeg (for those on Ubuntu 14.x) - The PBKDF2 iteration count for token caching was increased to 300,000 for extra security.
- Fix a bug where
play_file
wouldn't properly accept string file paths (#36, thanks @purintai) - Fix a concurrency issue where
VoiceBot
would try to read from nil
- The connection to voice was made more reliable. I haven't experienced any issues with it myself but I got reports where
recv
worked better thanrecvmsg
.
- Voice support: discordrb can now connect to voice using
bot.voice_connect
and do the following things:- Play files and URLs using
VoiceBot.play_file
- Play arbitrary streams using
VoiceBot.play_io
- Set the volume of future playbacks using
VoiceBot.volume=
- Pause and resume playback (
VoiceBot.pause
andVoiceBot.continue
)
- Play files and URLs using
- Authentication tokens are now cached and no login request will be made if a cached token is found. This is mostly to reduce strain on Discord's servers.
- Some latent ID casting errors were fixed - those would probably never have been noticed anyway, but they're fixed now.
Bot.parse_mention
now works, it didn't work at all previously
- The
User
class now has the methodsadd_role
andremove_role
which add a role to a user and remove it, respectively. - All data classes now have a useful
==
implementation. - The
Game
class and all references to it were removed. Games are now only identified by their name.
- When a role is deleted, the ID is now obtained correctly. (#30)
- Presence event handling is now divided into two separate events;
PresenceEvent
to handle online/offline/idle statuses andPlayingEvent
to handle users playing games. - The
user
property ofMessageEvent
is now automatically resolved to the cached user, so you can modify roles instantly without having to resolve it yourself. Message
now has a usefulto_s
method that just returns the content.
- The
TypingEvent
user
property is now initialized correctly (#29, thanks @purintai)
Bugfix-only release.
- The
user
andserver
properties ofPresenceEvent
are now initialized correctly.
- The
Bot.game
property can now be set to an arbitrary string. - Discord mentions are handled in the old way again, after Discord reverted an API change.
- Add
Server.leave_server
as an alias fordelete_server
- Use the new Discord mention format (mentions array). Reverted in 1.4.5
- Discord rate limited API calls are now handled correctly - discordrb will try again after the specified time.
- Debug logging is now handled by a separate
Logger
class
- Message timestamps are now parsed correctly.
- The quickadders for awaits (
User.await
,Channel.await
etc.) now add the correct awaits.
- Added a method
Bot.find_user
analogous toBot.find
.
- Remove a leftover debug line (#23, thanks @VxJasonxV)
- discordrb will now send a user agent in the format requested by the Discord devs.
Bugfix-only release.
- Empty messages will now never be sent
- The command-not-found message in
CommandBot
can now be disabled properly
- All methods and classes where the words "colour" or "color" are used now have had aliases added with the respective other spelling. (Internally, everything uses "colour" now).
- discordrb now supports everything on the Discord API comparison, except for voice (see also #22)
- Roles can now be created, edited and deleted and their permissions modified.
- There is now a method to get a channel's message history.
- The bot's user profile can now be edited.
- Servers can now be created, edited and deleted.
- The user can now display a "typing" message in a channel.
- Invites can now be created and deleted, and an
Invite
class was made to represent them.
- Command and event handling is now threaded, with each command/event handler execution in a separate thread.
- Debug messages now specify the current thread's name.
- discordrb now handles created/updated/deleted servers properly with events added to handle them.
- The list of games handled by Discord will now be updated automatically.
- Fixed a bug where command handling would crash if the command didn't exist.
- Add an attribute
Bot.should_parse_self
(false by default) that prevents the bot from raising an event if it receives a message from itself. User.bot?
andMessage.from_bot?
were implemented to check whether the user is the bot or the message was sent by it.- Add an event for private messages specifically (
Bot.pm
andPrivateMessageEvent
)
- Fix the
MessageEvent
attribute that checks whether the message is from the bot not working at all.
- Add a user selector (
:bot
) that is usable in thefrom:
MessageEvent
attribute to check whether the message was sent by a bot.
Channel.private?
now checks for the server being nil instead of theis_private
attribute provided by Discord as the latter is unreliable. (wtf)
- Add a method
Channel.private?
to check for a PM channel - Add a
MessageEvent
attribute (:private
) to check whether a message was sent in a PM channel - Add various aliases to
MessageEvent
attributes - Allow regexes to check for strings in
MessageEvent
attributes
- The
matches_all
method would break in certain edge cases. This didn't really affect discordrb and I don't think anyone else uses that method (it's pretty useless otherwise). This has been fixed
- Add awaits, a powerful way to add temporary event handlers.
- Add a
Bot.find
method to fuzzy-search for channels. - Add methods to kick, ban and unban users.
- Permission overrides now work correctly for private channels (i. e. they don't exist at all)
- Users joining and leaving servers are now handled correctly.
- Added
Bot.users
andBot.servers
readers to get the list of users and servers.
- POST requests to API calls that don't need a payload will now send a
nil
payload instead. This fixes the bot being unable to join any servers and various other latent problems. (#21, thanks @davidkus)
Bugfix-only release.
- Fix the command bot being included wrong, which caused crashes upon startup.
- The bot can now be stopped from the script using the new method
Bot.stop
.
- Fix some wrong file requires which caused crashes sometimes.
- The bot can now be run asynchronously using
Bot.run(:async)
to do further initialization after the bot was started.