Skip to content
Nick Choi edited this page Apr 6, 2016 · 11 revisions

This section will hopefully contain the most recent DiscordSharp changes that may or may not (but probably will) break your bot's code.

DiscordClient.RequestAllUsersOnStartup

By default, WebSocket ready will now be compressed and will NOT contain offline users. If you wish to have offline users pulled on startup, set this boolean to true. Startup will take significantly longer.

DiscordChannel Property Name Updates

The following changes have been recently made to the DiscordChannel object.

  • DiscordChannel.name -> DiscordChannel.Name
  • DiscordChannel.topic -> DiscordChannel.Topic
  • DiscordChannel.id -> DiscordChannel.ID
  • DiscordChannel.icon -> DiscordChannel.Icon
  • DiscordChannel.type -> DiscordChannel.Type
  • DiscordChannel.Type is now also an enum, ChannelType with the following properties: Text or Voice.

Message deletion methods

The following changes have been made to various message deletion methods.

  • DeletePrivateMessage has been removed. Use a regular DeleteMessage
  • DeleteMessage now has an option to take a full DiscordMessage object.
  • You can still use the old method that goes by ID but, this only pulls message from the internal message log.
  • DeleteMessagesFromClientInChannel has been removed.
  • If you want to delete more than 100 messages, do not use DeleteMultipleMessagesInChannel as this cuts off at 100.

DeleteMessagesInChannel => DeleteMessagesFromClientInChannel

Another misleading method now renamed.

DeleteAllMessagesInChannel

It was a really misleading method name, I know. Thus, I have decided to replace it with an excellent alternative provided by contributor @Siegen. The new method is DeleteMultipleMessagesInChannel and takes two arguments.

  • DiscordChannel object
  • int count (max 100, if you try to put in over 100 the API will lower it to 100.

If you want to repeat this method go ahead. It's recommend you add some sleeping though to prevent rate limiting.

Casting DiscordMessage.channel

Due to the new channel base/inheritence system, you will now need to cast to the proper Discord Channel type yourself. There are only two types of DiscordChannels and you will need to pick the best depending on your situation.

  • DiscordChannel - regular standard text/voice chat channel.
  • DiscordPrivateChannel - DM.

sry </3

DiscordPrivateChannel.DiscordRecipient

DiscordRecipient inside of DiscordPrivateChannel has been replaced by the new/updated DiscordMember object.

Obsoletion of DiscordUser

DiscordUser is now obsolete. DiscordMember will now house all of the properties associated with DiscordUser. Please don't hate me.

  • DiscordUser.username => DiscordMember.Username
  • DiscordUser.id => DiscordMember.ID
  • DiscordUser.discriminator => DiscordMember.Discriminator
  • DiscordUser.avatar => DiscordMember.Avatar (and two new functions associated with avatars, not tested though)
  • DiscordUser.verified => DiscordMember.Verified
  • DiscordUser.email => DiscordMember.Email
  • DiscordUser.mute => DiscordMember.Muted
  • DiscordUser.deaf => DiscordMember.Deaf

Now, instead of needing to type e.user.username to get the username, you can simply do e.Username. DiscordMember is still passed into functions unchanged.

SendMessageToChannel, Channel.SendMessage, EditMessage

All 3 of these methods now return a DiscordMessage object.

DiscordServer.owner_id

owner_id has been removed. Instead, please use DiscordServer.owner which will return a DiscordMember object of the owner of the server.

ChangeBotUsername

ChangeBotUsername has been renamed to ChangeClientUsername. Functionality is still the same.

ChangeBotInformation

ChangeBotInformation has been renamed to ChangeClientInformation. Functionality is still the same.

ChangeBotPicture

ChangeBotPicture has been renamed to ChangeClientAvatar. Functionality is still the same.

OnDebugMessageReceived

This event has been changed to TextClientDebugMessageReceived. Internally, DiscordSharp has two separate loggers for the main text client and the new(ish) voice client. LoggerMessageReceivedArgs.message should be replaced with LoggerMessageReceivedArgs.message.Message to get the raw text. Alternatively, you can also get the level and timestamp associated with the debug message.