Commit Graph

305 Commits

Author SHA1 Message Date
Christopher F
a384ce02ab Support listening/watching activity types
This resolves #931

As part of this change, StreamingType has been refactored to realign
with how Discord seems to define the 'type' field on activities now.

StreamType is renamed to ActivityType, and the following properties have
been changed:
- NotStreaming -> Playing
- Twitch -> Streaming

Additionally, the StreamType property/parameter has been removed from
StreamingGame, and moved up a scope to Game.

Normal Games may now set their type, to line up with changes in
Discord's official clients.
2018-01-13 23:29:59 -05:00
Christopher F
fdd2c80d2b Fix outgoing activity sending (#916)
This change resolves #916

Discord requires the {"type": 0} payload for all non-streaming
activities. This change fixes a bug where name-only games would fail to
include this payload, causing the presence change to be discarded by
Discord.
2018-01-06 23:20:21 -05:00
Christopher F
d5e9d6f9c1 Fix ShardedClient#GetShardFor null-case (#742)
This resolves #742.

Common cases for IGuild being null on access are DMs (since they do not
belong to a guild) - this change resolves null guilds to shard zero,
where DMs are also received.
2018-01-06 22:56:54 -05:00
Chris Johnston
edfbd055bb Fix #854 Added ViewChannel enum and property to channel permissions (#874)
* Fix #854 Added ViewChannel enum and property to channel permissions

* replaced usages of ChannelPermission#ReadMessages with ViewChannel

* rename parameter of ChannelPermissions constructor

* made OverwritePermissions#ReadMessages obsolete, use ViewChannel instead

* Fix #854 Added ViewChannel enum and property to channel permissions

replaced usages of ChannelPermission#ReadMessages with ViewChannel

rename parameter of ChannelPermissions constructor

made OverwritePermissions#ReadMessages obsolete, use ViewChannel instead

* renamed readMessages parameter in ChannelPermissions constructor and Modify

* fixed channel permission tests to use ChannelPermission enum instead of GuildPermission enum

* replaced usages of readmessages in channel permission tests

* resolve build warnings for permission tests
2018-01-06 22:35:17 -05:00
Christopher F
030422fa1d Add support for channel categories (#907)
commit a85c5814a74e473e95fe172f0379cbc7f9f951d8
Author: Christopher F <computerizedtaco@gmail.com>
Date:   Sat Jan 6 22:25:48 2018 -0500

    Code cleanup

commit 4b243fd3dd99152b4ebc7ee01d704bd8e57eeee1
Author: Christopher F <computerizedtaco@gmail.com>
Date:   Sat Jan 6 22:08:28 2018 -0500

    Add support for channel categories (#907)

    commit 41ed9106f2b05530acbf06b245c9aa618011d815
    Author: mrspits4ever <spits.lucas@gmail.com>
    Date:   Thu Dec 14 20:02:57 2017 +0100

        removed mentioning support for RestCategoryChannel, added channels property to SocketCategoryChannel

    commit 71142c310847886dff80c49e9357dd0786d67a1b
    Merge: 4589d731 678a7238
    Author: mrspits4ever <spits.lucas@gmail.com>
    Date:   Wed Dec 13 21:17:53 2017 +0100

        Merge branch 'dev' of https://github.com/RogueException/Discord.Net into feature/channel-categories

    commit 4589d73187871c98485ed25c6d223706927af7ec
    Author: mrspits4ever <spits.lucas@gmail.com>
    Date:   Wed Dec 13 21:17:46 2017 +0100

        adressed requested changes

    commit d59b038efa048b2279602e2015ddd2c185e58d63
    Author: pegasy <pegasy@users.noreply.github.com>
    Date:   Mon Sep 25 18:53:23 2017 +0200

        Renamed classes / properties / methods to use CategoryChannel instead of ChannelCategory to be consistant with how text / voice channels are named.

    commit 5c4777dc8cc443108f2e7e4afae98824c9a32b1f
    Author: pegasy <pegasy@users.noreply.github.com>
    Date:   Sun Sep 24 19:08:25 2017 +0200

        removed Guild from class name for ChannelCategory
        Renamed all properties to use Category instead of Parent
        Throw exception on GetUsers / GetInvites etc for categories

    commit e18bd8c799d2327270021c05866cb2e97ad4671b
    Author: pegasy <pegasy@users.noreply.github.com>
    Date:   Sun Sep 24 15:49:51 2017 +0200

        Add support for channel categories (as its own channel type)
2018-01-06 22:27:51 -05:00
Christopher F
c08f37bb03 Fix nullref exceptions from Rich Presences 2018-01-05 20:49:59 -05:00
Christopher F
5ce85deb9d Attempt to patch the GameParty nullref
Not sure if this works, needs a more proper solution in the future
anyways
2017-12-27 14:47:55 -05:00
Alex Gravely
7b2ddd027c Add missing REST Webhook implemenation (#843)
* Add Webhook API models, REST implementation, and Socket bridges.

* Remove token overrides from REST.

Leaving that as a Webhook package only feature.

* Add Webhook API models, REST implementation, and Socket bridges.

* Remove token overrides from REST.

Leaving that as a Webhook package only feature.

* Webhook core implementation.

* Webhook REST implementation.

* Webhook client implementation.

* Add channel bucket id.
2017-12-23 15:17:20 -05:00
Christopher F
a19ff188e9 Added support for animated emoji (#913)
* Added support for animated emoji

This was such a useful feature Discord, I'm glad you added this instead
of fixing bugs.

* Fix bugs in emote parser

* Added unit tests for emotes
2017-12-23 15:09:24 -05:00
Christopher F
34b4e5a6d2 Refactor Games, support reading Rich Presences (#877)
* Add API-level support for Rich Presences

* Add library-level support for Game presences

* Add model conversions for outgoing+incoming rich presences

* Refactored Game into Activities

* Integrated Activities with user entities

rebase hell from 5f3cb947a92f4fd01cc4df47ca548180036b47f3

* Fix JSON converters for Activities

* Finish rebase, activity should be set on BaseSocketClient

* Use ApplicationId to define a rich presence

* Added SetActivityAsync to Base and Sharded Socket clients

* Remove public parameterless Game constructor

* Remove GameAssets, refactored to GameAsset

* Hide constructors for types that should be read-only

* Revert changes to Discord.Net.sln

got damned visual studio caching

* Refactor GameParty to use dedicated current/capacity values

Per feedback from @khionu
2017-12-23 14:58:35 -05:00
Christopher F
678a7238e6 Allow users to opt-in to proxies (#888)
* Allow users to opt-in to proxies

* Allow opting in to proxies on the WebSocket
2017-12-07 16:47:01 -05:00
Mateusz Brawański
b4bf046ad4 Implemented emoji endpoints (#835)
* Implemented emoji endpoints.

* Fixed: now using API entities for REST client.

* Removed emoji listing endpoint, as per @foxbot's request.
2017-11-20 15:02:42 -05:00
Christopher F
9979a027d5 Change default InviteAge to 24 hours
Resolves #859
2017-11-10 15:39:33 -05:00
enzosk8
da335b95c4 Fix general typos (#852) 2017-11-05 22:05:19 -05:00
Finite Reality
759db34146 Remove payload compression, use stream compression (#853) 2017-10-21 13:51:20 -04:00
Alex Gravely
e00f17fe55 Move DeleteMessagesAsync from IMessageChannel to ITextChannel (#829) 2017-10-01 15:37:13 -04:00
Christopher F
347c5a0d39 Disable obsolete warnings in files that reference TokenType.User 2017-09-29 17:37:07 -04:00
Chris Johnston
f8108871d6 Typo fix for SocketGuildUser.Hierarchy description (#831) 2017-09-28 16:26:23 -04:00
Alex Gravely
9b7afec4cc Add BaseSocketClient object. (#773)
* Add BaseDiscordClient. Add various missing RequestOptions args.

DiscordSocketClient and DiscordShardedClient's shared members now exist in this abstract class.

* Add ShardReady event.

* Style consistency. Remove extraneous overloads.

Remove extraneous overloads.

* Add BaseSocketClient#DownloadUsersAsync().

Style cleanups.

* Add ShardLatencyUpdated event.

Style cleanup.

* Hook LatencyUpdated for ShardedClient.

* Begone whitespace.

* I'm good at this, I swear. >_>

* Add back DiscordShardedClient.UserPresenceUpdated

* Add ObsoleteAttribute

* Removing the UserPresenceUpdated event.
2017-09-27 18:20:31 -04:00
Chris Johnston
30e867a183 Implement welcome message channels (#819) 2017-09-23 17:00:08 -04:00
Alex Gravely
ec03883e26 Create unspecified channel object for unknown channel types (#811)
* Partial fix of #810, addresses critical connection issues.

* Implement fix for REST.

* Implement fix on RestChannel.
2017-09-09 15:56:03 +01:00
Christopher F
608bc359ee Removed IChannel#Nsfw, added to ITextChannel 2017-08-29 17:26:36 -04:00
Christopher F
5d7f2fc7ec Add GetReactionUsersAsync(IEmote) overload (#731)
* Add GetReactionUsersAsync(IEmote) overload

Resolves #730

* Remove obsolete GetReactionUsersAsync(string) overload
2017-08-29 17:09:28 -04:00
Christopher F
4205d68b5a Don't throw when receiving a presence for a user that doesn't exist (#746) 2017-08-29 16:26:31 -04:00
Christopher F
1ffcd4bfa7 Changed Guild#DefaultChannel to resolve the first accessible channel (#777)
* Changed Guild#DefaultChannel to resolve the first accessible channel

Resolves #776

This change is inline with hammerandchisel/discord-api-docs#329

RestGuild#DefaultChannelId is now obsolete and will throw a
NotSupportedException.

* RestGuild#DefaultChannelId will fall back to the guild ID

Adding an exception here would be a breaking change, so this was agreed
to fall back to the previous behavior, which would just return the guild
ID.
2017-08-28 16:49:16 -04:00
Christopher F
182f00f8ce Reworked IChannel.IsNsfw to support the new API flag (#771)
IChannel.IsNsfw will now return false when being used on any channel
that is not an ITextChannel. When being used on an ITextChannel, this
will now account for the API flag, and fall back to the channel name.

(this is gross design, thanks discord)
2017-08-28 16:45:53 -04:00
RogueException
f997089174 Try to pull DM channels from cache on CHANNEL_CREATE 2017-08-17 02:54:19 -03:00
Alex Gravely
6b5a6e7f1f Fix everyone mention. (#755)
* Update RestRole.cs

Fix everyone mention.

* Update SocketRole.cs

Fix everyone mention.

* I'm good at this, I swear.
2017-08-17 02:47:37 -03:00
Joe4evr
8cd99beb62 Unify ShardedCommandContext with SocketCommandContext (#739)
* Make ShardedCommandContext derive from SocketCommandContext

* Explicitly re-implement ICommandContext.Client
2017-07-05 20:23:46 -03:00
RogueException
14dfc48df3 Style cleanup 2017-06-29 19:44:32 -03:00
Pat Murphy
224d0403db Adding Equals() overloads for reactions/emotes (#723) 2017-06-29 18:05:16 -03:00
Christopher F
1ce1c019b3 Add support for audit log reasons (#708)
* Add support for audit log reasons

* Made changes per discussion
2017-06-29 17:01:59 -03:00
Alex Gravely
707ec95717 Add SocketRole.Members property (#659)
* Add SocketRole.Members property

* Change Members to IEnumerable.
2017-06-23 12:01:44 -03:00
Amir Zaidi
d088d7b05c Add packetLoss argument for PCM streams, change FrameBytes to FrameSamplesPerChannel in OpusEncodeStream (#677) 2017-06-23 11:48:42 -03:00
Christopher F
5f04e2beba Cache outgoing presence data if disconnected (#705)
This resolves #702
2017-06-23 11:29:45 -03:00
Christopher F
1942637380 Merge pull request #656 from AntiTcb/fix/GetDMChannelAsync
Remove IUser.CreateDMChannelAsync / Fix SocketGlobalUser.DMChannel
2017-06-16 21:22:56 -04:00
AntiTcb
fb57a61432 Rename to GetOrCreateDMChannelAsync 2017-06-16 20:43:50 -04:00
Alex Gravely
8c2a46e9e7 Add ulong overload to IMessageChannel.DeleteMessagesAsync (#649) 2017-06-15 12:05:41 -03:00
AntiTcb
73611d1fab Remove IUser.CreateDMChannelAsync, implicitly implement IUser.GetDMChannelAsync 2017-05-27 14:47:12 -04:00
RogueException
8eb9b2071c Set hasHeader in SodiumEncrypt 2017-05-25 21:45:41 -03:00
RogueException
333881a711 Expose audio header more often 2017-05-25 13:54:57 -03:00
AntiTcb
7db38f32bb Attach/Remove DMChannel to SocketGlobalUser.DMChannel property 2017-05-16 20:04:25 -04:00
AntiTcb
33a91ba3de Remove redundant explicit interface definition. 2017-05-16 20:03:38 -04:00
AntiTcb
aeef5d0893 Update DM channel on entity updates. 2017-05-16 20:03:17 -04:00
AntiTcb
6fed78025c Create DM channel if one does not exist. 2017-05-16 20:02:32 -04:00
RogueException
4c7fad78e1 Build promises when guild is unavailable 2017-05-10 19:28:25 -03:00
RogueException
285a0e5817 Updated deps, cleaned csprojs 2017-05-09 20:51:00 -03:00
Sindre Langhus
82a413ace6 Fix for empty user objects after GUILD_MEMBER_REMOVE (#641)
* Made GetOrCreateUser always call AddRef and added check to PRESENCE_UPDATE to avoid readding users who have been removed from guilds

* Removed AddRef as per dev guild discussion
2017-05-04 13:16:33 -03:00
RogueException
4a128b326b Increment globaluser refs on private channel creation 2017-05-04 13:14:35 -03:00
RogueException
bd5ec0a29a Increment GlobalUser reference count on GuildUser creation 2017-05-04 13:09:55 -03:00