@@ -127,7 +127,7 @@ publish/ | |||
# Publish Web Output | |||
*.[Pp]ublish.xml | |||
*.azurePubxml | |||
# TODO: Comment the next line if you want to checkin your web deploy settings | |||
# TODO: Comment the next line if you want to checkin your web deploy settings | |||
# but database connection strings (with potential passwords) will be unencrypted | |||
*.pubxml | |||
*.publishproj | |||
@@ -151,7 +151,6 @@ AppPackages/ | |||
# Others | |||
*.[Cc]ache | |||
ClientBin/ | |||
[Ss]tyle[Cc]op.* | |||
~$* | |||
*~ | |||
*.dbmdl | |||
@@ -206,4 +205,4 @@ docs/api/\.manifest | |||
\.idea/ | |||
# Codealike UID | |||
codealike.json | |||
codealike.json |
@@ -1,5 +1,96 @@ | |||
# Changelog | |||
## [2.3.0] - 2021-01-28 | |||
### Added | |||
- #1491 Add INVITE_CREATE and INVITE_DELETE events (1ab670b) | |||
- #1520 Support reading multiple activities (421a0c1) | |||
- #1521 Allow for inherited commands in modules (a51cdf6) | |||
- #1526 Add Direction.Around to GetMessagesAsync (f2130f8) | |||
- #1537 Implement gateway ratelimit (ec673e1) | |||
- #1544 Add MESSAGE_REACTION_REMOVE_EMOJI and RemoveAllReactionsForEmoteAsync (a89f076) | |||
- #1549 Add GetUsersAsync to SocketGuild (30b5a83) | |||
- #1566 Support Gateway Intents (d5d10d3) | |||
- #1573 Add missing properties to Guild and deprecate GuildEmbed (ec212b1) | |||
- #1581 Add includeRoleIds to PruneUsersAsync (a80e5ff) | |||
- #1588 Add GetStreams to AudioClient (1e012ac) | |||
- #1596 Add missing channel properties (2d80037) | |||
- #1604 Add missing application properties (including Teams) (10fcde0) | |||
- #1619 Add "View Guild Insights" to GuildPermission (2592264) | |||
- #1637 Added CultureInvariant RegexOption to WebhookUrlRegex (e3925a7) | |||
- #1659 Add inline replies (e3850e1) | |||
- #1688 Send presence on Identify payload (25d5d36) | |||
- #1721 Add role tags (6a62c47) | |||
- #1722 Add user public flags (c683b29) | |||
- #1724 Add MessageFlags and AllowedMentions to message modify (225550d) | |||
- #1731 Add GuildUser IsPending property (8b25c9b) | |||
- #1690 Add max bitrate value to SocketGuild (aacfea0) | |||
### Fixed | |||
- #1244 Missing AddReactions permission for DM channels. (e40ca4a) | |||
- #1469 unsupported property causes an exception (468f826) | |||
- #1525 AllowedMentions and AllowedMentionTypes (3325031) | |||
- #1531 Add AllowedMentions to SendFileAsync (ab32607) | |||
- #1532 GuildEmbed.ChannelId as nullable per API documentation (971d519) | |||
- #1546 Different ratelimits for the same route (implement discord buckets) (2f6c017) | |||
- #1548 Incomplete Ready, DownloadUsersAsync, and optimize AlwaysDownloadUsers (dc8c959) | |||
- #1555 InvalidOperationException at MESSAGE_CREATE (bd4672a) | |||
- #1557 Sending 2 requests instead of 1 to create a Guild role. (5430cc8) | |||
- #1571 Not using the new domain name. (df8a0f7) | |||
- #1578 Trim token before passing it to the authorization header (42ba372) | |||
- #1580 Stop TaskCanceledException from bubbling up (b8fa464) | |||
- #1599 Invite audit log without inviter (b95b95b) | |||
- #1602 Add AllowedMentions to webhooks (bd4516b) | |||
- #1603 Cancel reconnection when 4014 (f396cd9) | |||
- #1608 Voice overwrites and CategoryId remarks (43c8fc0) | |||
- #1614 Check error 404 and return null for GetBanAsync (ae9fff6) | |||
- #1621 Parse mentions from message payload (366ca9a) | |||
- #1622 Do not update overwrite cache locally (3860da0) | |||
- #1623 Invoke UserUpdated from GuildMemberUpdated if needed (3085e88) | |||
- #1624 Handle null PreferredLocale in rare cases (c1d04b4) | |||
- #1639 Invite and InviteMetadata properties (dd2e524) | |||
- #1642 Add missing permissions (4b389f3) | |||
- #1647 handicap member downloading for verified bots (fa5ef5e) | |||
- #1652 Update README.MD to reflect new discord domain (03b831e) | |||
- #1667 Audio stream dispose (a2af985) | |||
- #1671 Crosspost throwing InvalidOperationException (9134443) | |||
- #1672 Team is nullable, not optional (be60d81) | |||
- #1681 Emoji url encode (04389a4) | |||
- #1683 SocketGuild.HasAllMembers is false if a user left a guild (47f571e) | |||
- #1686 Revert PremiumSubscriptionCount type (97e71cd) | |||
- #1695 Possible NullReferenceException when receiving InvalidSession (5213916) | |||
- #1702 Rollback Activities to Game (9d7cb39) | |||
- #1727 Move and fix internal AllowedMentions object (4a7f8fe) | |||
- limit request members batch size (084db25) | |||
- UserMentions throwing NullRef (5ed01a3) | |||
- Wrong author for SocketUserMessage.ReferencedMessage (1e9b252) | |||
- Discord sends null when there's no team (05a1f0a) | |||
- IMessage.Embeds docs remarks (a4d32d3) | |||
- Missing MessageReference when sending files (2095701) | |||
### Misc | |||
- #1545 MutualGuilds optimization (323a677) | |||
- #1551 Update webhook regex to support discord.com (7585789) | |||
- #1556 Add SearchUsersAsync (57880de) | |||
- #1561 Minor refactor to switch expression (42826df) | |||
- #1576 Updating comments for privileged intents (c42bfa6) | |||
- #1678 Change ratelimit messages (47ed806) | |||
- #1714 Update summary of SocketVoiceChannel.Users (e385c40) | |||
- #1720 VoiceRegions and related changes (5934c79) | |||
- Add updated libraries for LastModified (d761846) | |||
- Add alternative documentation link (accd351) | |||
- Temporarily disable StyleCops until all the fixes are impl'd (36de7b2) | |||
- Remove redundant CreateGuildRoleParams (3df0539) | |||
- Add minor tweaks to DiscordSocketConfig docs strings (2cd1880) | |||
- Fix MaxWaitBetweenGuildAvailablesBeforeReady docs string (e31cdc7) | |||
- Missing summary tag for GatewayIntents (3a10018) | |||
- Add new method of role ID copy (857ef77) | |||
- Resolve inheritdocs for IAttachment (9ea3291) | |||
- Mark null as a specific langword in summary (13a41f8) | |||
- Cleanup GatewayReconnectException docs (833ee42) | |||
- Update Docfx.Plugins.LastModified to v1.2.4 (28a6f97) | |||
- Update framework version for tests to Core 3.1 to comply with LTS (4988a07) | |||
- Move bulk deletes remarks from <summary> to <remarks> (62539f0) | |||
## [2.2.0] - 2020-04-16 | |||
### Added | |||
- #1247 Implement Client Status Support (9da11b4) | |||
@@ -1,15 +1,15 @@ | |||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<PropertyGroup> | |||
<VersionPrefix>2.3.0</VersionPrefix> | |||
<VersionPrefix>2.3.1</VersionPrefix> | |||
<VersionSuffix>dev</VersionSuffix> | |||
<LangVersion>latest</LangVersion> | |||
<Authors>Discord.Net Contributors</Authors> | |||
<PackageTags>discord;discordapp</PackageTags> | |||
<PackageProjectUrl>https://github.com/RogueException/Discord.Net</PackageProjectUrl> | |||
<PackageProjectUrl>https://github.com/Discord-Net/Discord.Net</PackageProjectUrl> | |||
<PackageLicenseUrl>http://opensource.org/licenses/MIT</PackageLicenseUrl> | |||
<PackageIconUrl>https://github.com/RogueException/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png</PackageIconUrl> | |||
<PackageIconUrl>https://github.com/Discord-Net/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png</PackageIconUrl> | |||
<RepositoryType>git</RepositoryType> | |||
<RepositoryUrl>git://github.com/RogueException/Discord.Net</RepositoryUrl> | |||
<RepositoryUrl>git://github.com/Discord-Net/Discord.Net</RepositoryUrl> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(BuildNumber)' == '' "> | |||
<VersionSuffix Condition=" '$(VersionSuffix)' != ''">$(VersionSuffix)-dev</VersionSuffix> | |||
@@ -2,11 +2,16 @@ | |||
[](https://www.nuget.org/packages/Discord.Net) | |||
[](https://www.myget.org/feed/Packages/discord-net) | |||
[](https://dev.azure.com/discord-net/Discord.Net/_build/latest?definitionId=1&branchName=dev) | |||
[](https://discord.gg/jkrBmQR) | |||
[](https://discord.gg/jkrBmQR) | |||
An unofficial .NET API Wrapper for the Discord client (http://discordapp.com). | |||
An unofficial .NET API Wrapper for the Discord client (https://discord.com). | |||
Check out the [documentation](https://discord.foxbot.me/) or join the [Discord API Chat](https://discord.gg/jkrBmQR). | |||
## Documentation | |||
- [Stable](https://discord.foxbot.me/) | |||
- Hosted by @foxbot | |||
- [Nightly](https://docs.stillu.cc/) | |||
- [Latest CI repo](https://github.com/discord-net/docs-static) | |||
## Installation | |||
### Stable (NuGet) | |||
@@ -0,0 +1,9 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<!-- <ItemGroup> | |||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.205" PrivateAssets="all" /> | |||
</ItemGroup> | |||
<PropertyGroup> | |||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> | |||
</PropertyGroup> --> | |||
</Project> |
@@ -4,10 +4,10 @@ field, and 2 normal fields using an @Discord.EmbedBuilder: | |||
```cs | |||
var exampleAuthor = new EmbedAuthorBuilder() | |||
.WithName("I am a bot") | |||
.WithIconUrl("https://discordapp.com/assets/e05ead6e6ebc08df9291738d0aa6986d.png"); | |||
.WithIconUrl("https://discord.com/assets/e05ead6e6ebc08df9291738d0aa6986d.png"); | |||
var exampleFooter = new EmbedFooterBuilder() | |||
.WithText("I am a nice footer") | |||
.WithIconUrl("https://discordapp.com/assets/28174a34e77bb5e5310ced9f95cb480b.png"); | |||
.WithIconUrl("https://discord.com/assets/28174a34e77bb5e5310ced9f95cb480b.png"); | |||
var exampleField = new EmbedFieldBuilder() | |||
.WithName("Title of Another Field") | |||
.WithValue("I am an [example](https://example.com).") | |||
@@ -22,4 +22,4 @@ var embed = new EmbedBuilder() | |||
.WithAuthor(exampleAuthor) | |||
.WithFooter(exampleFooter) | |||
.Build(); | |||
``` | |||
``` |
@@ -1,4 +1,4 @@ | |||
<configuration> | |||
<dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-a904fc6" target="lib/linux-x64/libgit2-a904fc6.so" /> | |||
<dllmap os="osx" cpu="x86,x86-64" dll="git2-a904fc6" target="lib/osx/libgit2-a904fc6.dylib" /> | |||
<configuration> | |||
<dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-ef5a385" target="lib/linux-x64/libgit2-ef5a385.so" /> | |||
<dllmap os="osx" cpu="x86,x86-64" dll="git2-ef5a385" target="lib/osx/libgit2-ef5a385.dylib" /> | |||
</configuration> |
@@ -27,7 +27,8 @@ | |||
</div> | |||
{{/_disableContribution}} | |||
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix"> | |||
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> --> | |||
<h5>{{__global.inThisArticle}}</h5> | |||
<div></div> | |||
</nav> | |||
</div> | |||
</div> |
@@ -30,7 +30,7 @@ There are few possible reasons why this may occur. | |||
[TokenType]: xref:Discord.TokenType | |||
[827]: https://github.com/RogueException/Discord.Net/issues/827 | |||
[958]: https://github.com/RogueException/Discord.Net/issues/958 | |||
[Discord API Terms of Service]: https://discordapp.com/developers/docs/legal | |||
[Discord API Terms of Service]: https://discord.com/developers/docs/legal | |||
## How do I do X, Y, Z when my bot connects/logs on? Why do I get a `NullReferenceException` upon calling any client methods after connect? | |||
@@ -74,6 +74,9 @@ it will return the user ID of the aforementioned user. | |||
Several common ways to do this: | |||
1. Make the role mentionable and mention the role, and escape it | |||
1. (Easiest) Right click on the role either in the Server Settings | |||
or in the user's role list. | |||
 | |||
2. Make the role mentionable and mention the role, and escape it | |||
using the `\` character in front. | |||
2. Inspect the roles collection within the guild via your debugger. | |||
3. Inspect the roles collection within the guild via your debugger. |
@@ -19,7 +19,7 @@ channels, and are often referred to as "servers". | |||
* A **Channel** ([IChannel]) represents a generic channel. | |||
- Example: #dotnet_discord-net | |||
- See [Channel Types](#channel-types) | |||
[IGuild]: xref:Discord.IGuild | |||
[IChannel]: xref:Discord.IChannel | |||
@@ -79,4 +79,4 @@ activity for listening to a song on Spotify. | |||
[RichGame]: xref:Discord.RichGame | |||
[StreamingGame]: xref:Discord.StreamingGame | |||
[SpotifyGame]: xref:Discord.SpotifyGame | |||
[Rich Presence Intro]: https://discordapp.com/developers/docs/rich-presence/best-practices | |||
[Rich Presence Intro]: https://discord.com/developers/docs/rich-presence/best-practices |
@@ -31,7 +31,7 @@ the Discord Applications Portal first. | |||
 | |||
[Discord Applications Portal]: https://discordapp.com/developers/applications/ | |||
[Discord Applications Portal]: https://discord.com/developers/applications/ | |||
## Adding your bot to a server | |||
@@ -165,11 +165,11 @@ or any other blocking method, such as reading from the console. | |||
> the source code for your bot. | |||
> | |||
> In the following example, we retrieve the token from a pre-defined | |||
> variable, which is **NOT** secure, especially if you plan on | |||
> variable, which is **NOT** secure, especially if you plan on | |||
> distributing the application in any shape or form. | |||
> | |||
> We recommend alternative storage such as | |||
> [Environment Variables], an external configuration file, or a | |||
> We recommend alternative storage such as | |||
> [Environment Variables], an external configuration file, or a | |||
> secrets manager for safe-handling of secrets. | |||
> | |||
> [Environment Variables]: https://en.wikipedia.org/wiki/Environment_variable | |||
@@ -221,4 +221,4 @@ should be to separate... | |||
2. the modules (handle commands) | |||
3. the services (persistent storage, pure functions, data manipulation) | |||
[CommandService]: xref:Discord.Commands.CommandService | |||
[CommandService]: xref:Discord.Commands.CommandService |
@@ -11,12 +11,12 @@ title: Home | |||
[](https://www.nuget.org/packages/Discord.Net) | |||
[](https://www.myget.org/feed/Packages/discord-net) | |||
[](https://dev.azure.com/discord-net/Discord.Net/_build/latest?definitionId=1&branchName=dev) | |||
[](https://discord.gg/jkrBmQR) | |||
[](https://discord.gg/jkrBmQR) | |||
## What is Discord.Net? | |||
Discord.Net is an asynchronous, multi-platform .NET Library used to | |||
interface with the [Discord API](https://discordapp.com/). | |||
interface with the [Discord API](https://discord.com/). | |||
## Where to begin? | |||
@@ -14,10 +14,10 @@ namespace _04_webhook_client | |||
public async Task MainAsync() | |||
{ | |||
// The webhook url follows the format https://discordapp.com/api/webhooks/{id}/{token} | |||
// The webhook url follows the format https://discord.com/api/webhooks/{id}/{token} | |||
// Because anyone with the webhook URL can use your webhook | |||
// you should NOT hard code the URL or ID + token into your application. | |||
using (var client = new DiscordWebhookClient("https://discordapp.com/api/webhooks/123/abc123")) | |||
// you should NOT hard code the URL or ID + token into your application. | |||
using (var client = new DiscordWebhookClient("https://discord.com/api/webhooks/123/abc123")) | |||
{ | |||
var embed = new EmbedBuilder | |||
{ | |||
@@ -26,7 +26,7 @@ namespace _04_webhook_client | |||
}; | |||
// Webhooks are able to send multiple embeds per message | |||
// As such, your embeds must be passed as a collection. | |||
// As such, your embeds must be passed as a collection. | |||
await client.SendMessageAsync(text: "Send a message to this webhook!", embeds: new[] { embed.Build() }); | |||
} | |||
} | |||
@@ -136,7 +136,7 @@ namespace Discord.Commands | |||
builder.Name = typeInfo.Name; | |||
// Get all methods (including from inherited members), that are valid commands | |||
var validCommands = typeInfo.GetMethods().Where(IsValidCommandDefinition); | |||
var validCommands = typeInfo.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Where(IsValidCommandDefinition); | |||
foreach (var method in validCommands) | |||
{ | |||
@@ -1,5 +1,6 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<Import Project="../../Discord.Net.targets" /> | |||
<Import Project="../../StyleAnalyzer.targets"/> | |||
<PropertyGroup> | |||
<AssemblyName>Discord.Net.Commands</AssemblyName> | |||
<RootNamespace>Discord.Commands</RootNamespace> | |||
@@ -35,9 +35,10 @@ namespace Discord.Commands | |||
/// Specifies if notifications are sent for mentioned users and roles in the <paramref name="message"/>. | |||
/// If <c>null</c>, all mentioned roles and users will be notified. | |||
/// </param> | |||
protected virtual async Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null) | |||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
protected virtual async Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null) | |||
{ | |||
return await Context.Channel.SendMessageAsync(message, isTTS, embed, options, allowedMentions).ConfigureAwait(false); | |||
return await Context.Channel.SendMessageAsync(message, isTTS, embed, options, allowedMentions, messageReference).ConfigureAwait(false); | |||
} | |||
/// <summary> | |||
/// The method to execute before executing the command. | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Threading.Tasks; | |||
namespace Discord.Audio | |||
@@ -20,6 +21,9 @@ namespace Discord.Audio | |||
/// <summary> Gets the estimated round-trip latency, in milliseconds, to the voice UDP server. </summary> | |||
int UdpLatency { get; } | |||
/// <summary>Gets the current audio streams.</summary> | |||
IReadOnlyDictionary<ulong, AudioInStream> GetStreams(); | |||
Task StopAsync(); | |||
Task SetSpeakingAsync(bool value); | |||
@@ -7,6 +7,17 @@ namespace Discord | |||
/// </summary> | |||
public static class CDN | |||
{ | |||
/// <summary> | |||
/// Returns a team icon URL. | |||
/// </summary> | |||
/// <param name="teamId">The team identifier.</param> | |||
/// <param name="iconId">The icon identifier.</param> | |||
/// <returns> | |||
/// A URL pointing to the team's icon. | |||
/// </returns> | |||
public static string GetTeamIconUrl(ulong teamId, string iconId) | |||
=> iconId != null ? $"{DiscordConfig.CDNUrl}team-icons/{teamId}/{iconId}.jpg" : null; | |||
/// <summary> | |||
/// Returns an application icon URL. | |||
/// </summary> | |||
@@ -62,11 +73,21 @@ namespace Discord | |||
/// <param name="guildId">The guild snowflake identifier.</param> | |||
/// <param name="splashId">The splash icon identifier.</param> | |||
/// <returns> | |||
/// A URL pointing to the guild's icon. | |||
/// A URL pointing to the guild's splash. | |||
/// </returns> | |||
public static string GetGuildSplashUrl(ulong guildId, string splashId) | |||
=> splashId != null ? $"{DiscordConfig.CDNUrl}splashes/{guildId}/{splashId}.jpg" : null; | |||
/// <summary> | |||
/// Returns a guild discovery splash URL. | |||
/// </summary> | |||
/// <param name="guildId">The guild snowflake identifier.</param> | |||
/// <param name="discoverySplashId">The discovery splash icon identifier.</param> | |||
/// <returns> | |||
/// A URL pointing to the guild's discovery splash. | |||
/// </returns> | |||
public static string GetGuildDiscoverySplashUrl(ulong guildId, string discoverySplashId) | |||
=> discoverySplashId != null ? $"{DiscordConfig.CDNUrl}discovery-splashes/{guildId}/{discoverySplashId}.jpg" : null; | |||
/// <summary> | |||
/// Returns a channel icon URL. | |||
/// </summary> | |||
/// <param name="channelId">The channel snowflake identifier.</param> | |||
@@ -1,5 +1,6 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<Import Project="../../Discord.Net.targets" /> | |||
<Import Project="../../StyleAnalyzer.targets"/> | |||
<PropertyGroup> | |||
<AssemblyName>Discord.Net.Core</AssemblyName> | |||
<RootNamespace>Discord</RootNamespace> | |||
@@ -13,7 +13,7 @@ namespace Discord | |||
/// <returns> | |||
/// An <see cref="int"/> representing the API version that Discord.Net uses to communicate with Discord. | |||
/// <para>A list of available API version can be seen on the official | |||
/// <see href="https://discordapp.com/developers/docs/reference#api-versioning">Discord API documentation</see> | |||
/// <see href="https://discord.com/developers/docs/reference#api-versioning">Discord API documentation</see> | |||
/// .</para> | |||
/// </returns> | |||
public const int APIVersion = 6; | |||
@@ -50,7 +50,7 @@ namespace Discord | |||
/// <returns> | |||
/// The Discord API URL using <see cref="APIVersion"/>. | |||
/// </returns> | |||
public static readonly string APIUrl = $"https://discordapp.com/api/v{APIVersion}/"; | |||
public static readonly string APIUrl = $"https://discord.com/api/v{APIVersion}/"; | |||
/// <summary> | |||
/// Returns the base Discord CDN URL. | |||
/// </summary> | |||
@@ -1,3 +1,5 @@ | |||
using System.Collections.Generic; | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
@@ -26,9 +28,13 @@ namespace Discord | |||
/// </summary> | |||
/// <remarks> | |||
/// Setting this value to a category's snowflake identifier will change or set this channel's parent to the | |||
/// specified channel; setting this value to <c>0</c> will detach this channel from its parent if one | |||
/// specified channel; setting this value to <see langword="null"/> will detach this channel from its parent if one | |||
/// is set. | |||
/// </remarks> | |||
public Optional<ulong?> CategoryId { get; set; } | |||
/// <summary> | |||
/// Gets or sets the permission overwrites for this channel. | |||
/// </summary> | |||
public Optional<IEnumerable<Overwrite>> PermissionOverwrites { get; set; } | |||
} | |||
} |
@@ -27,11 +27,12 @@ namespace Discord | |||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | |||
/// If <c>null</c>, all mentioned roles and users will be notified. | |||
/// </param> | |||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
/// <returns> | |||
/// A task that represents an asynchronous send operation for delivering the message. The task result | |||
/// contains the sent message. | |||
/// </returns> | |||
Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null); | |||
Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null); | |||
/// <summary> | |||
/// Sends a file to this message channel with an optional caption. | |||
/// </summary> | |||
@@ -63,11 +64,12 @@ namespace Discord | |||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | |||
/// If <c>null</c>, all mentioned roles and users will be notified. | |||
/// </param> | |||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
/// <returns> | |||
/// A task that represents an asynchronous send operation for delivering the message. The task result | |||
/// contains the sent message. | |||
/// </returns> | |||
Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null); | |||
Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null); | |||
/// <summary> | |||
/// Sends a file to this message channel with an optional caption. | |||
/// </summary> | |||
@@ -96,11 +98,12 @@ namespace Discord | |||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | |||
/// If <c>null</c>, all mentioned roles and users will be notified. | |||
/// </param> | |||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
/// <returns> | |||
/// A task that represents an asynchronous send operation for delivering the message. The task result | |||
/// contains the sent message. | |||
/// </returns> | |||
Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null); | |||
Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null); | |||
/// <summary> | |||
/// Gets a message from this message channel. | |||
@@ -0,0 +1,9 @@ | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
/// Represents a generic news channel in a guild that can send and receive messages. | |||
/// </summary> | |||
public interface INewsChannel : ITextChannel | |||
{ | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
/// Stores the gateway information related to the current bot. | |||
/// </summary> | |||
public class BotGateway | |||
{ | |||
/// <summary> | |||
/// Gets the WSS URL that can be used for connecting to the gateway. | |||
/// </summary> | |||
public string Url { get; internal set; } | |||
/// <summary> | |||
/// Gets the recommended number of shards to use when connecting. | |||
/// </summary> | |||
public int Shards { get; internal set; } | |||
/// <summary> | |||
/// Gets the <see cref="SessionStartLimit"/> that contains the information | |||
/// about the current session start limit. | |||
/// </summary> | |||
public SessionStartLimit SessionStartLimit { get; internal set; } | |||
} | |||
} |
@@ -0,0 +1,38 @@ | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
/// Stores the information related to the gateway identify request. | |||
/// </summary> | |||
public class SessionStartLimit | |||
{ | |||
/// <summary> | |||
/// Gets the total number of session starts the current user is allowed. | |||
/// </summary> | |||
/// <returns> | |||
/// The maximum amount of session starts the current user is allowed. | |||
/// </returns> | |||
public int Total { get; internal set; } | |||
/// <summary> | |||
/// Gets the remaining number of session starts the current user is allowed. | |||
/// </summary> | |||
/// <returns> | |||
/// The remaining amount of session starts the current user is allowed. | |||
/// </returns> | |||
public int Remaining { get; internal set; } | |||
/// <summary> | |||
/// Gets the number of milliseconds after which the limit resets. | |||
/// </summary> | |||
/// <returns> | |||
/// The milliseconds until the limit resets back to the <see cref="Total"/>. | |||
/// </returns> | |||
public int ResetAfter { get; internal set; } | |||
/// <summary> | |||
/// Gets the maximum concurrent identify requests in a time window. | |||
/// </summary> | |||
/// <returns> | |||
/// The maximum concurrent identify requests in a time window, | |||
/// limited to the same rate limit key. | |||
/// </returns> | |||
public int MaxConcurrency { get; internal set; } | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
/// Provides properties that are used to modify the widget of an <see cref="IGuild" /> with the specified changes. | |||
/// </summary> | |||
public class GuildWidgetProperties | |||
{ | |||
/// <summary> | |||
/// Sets whether the widget should be enabled. | |||
/// </summary> | |||
public Optional<bool> Enabled { get; set; } | |||
/// <summary> | |||
/// Sets the channel that the invite should place its users in, if not <see langword="null" />. | |||
/// </summary> | |||
public Optional<IChannel> Channel { get; set; } | |||
/// <summary> | |||
/// Sets the channel that the invite should place its users in, if not <see langword="null" />. | |||
/// </summary> | |||
public Optional<ulong?> ChannelId { get; set; } | |||
} | |||
} |
@@ -23,7 +23,7 @@ namespace Discord | |||
/// automatically moved to the AFK voice channel. | |||
/// </summary> | |||
/// <returns> | |||
/// An <see cref="int"/> representing the amount of time in seconds for a user to be marked as inactive | |||
/// An <see langword="int"/> representing the amount of time in seconds for a user to be marked as inactive | |||
/// and moved into the AFK voice channel. | |||
/// </returns> | |||
int AFKTimeout { get; } | |||
@@ -31,10 +31,17 @@ namespace Discord | |||
/// Gets a value that indicates whether this guild is embeddable (i.e. can use widget). | |||
/// </summary> | |||
/// <returns> | |||
/// <c>true</c> if this guild can be embedded via widgets; otherwise <c>false</c>. | |||
/// <see langword="true" /> if this guild has a widget enabled; otherwise <see langword="false" />. | |||
/// </returns> | |||
bool IsEmbeddable { get; } | |||
/// <summary> | |||
/// Gets a value that indicates whether this guild has the widget enabled. | |||
/// </summary> | |||
/// <returns> | |||
/// <see langword="true" /> if this guild has a widget enabled; otherwise <see langword="false" />. | |||
/// </returns> | |||
bool IsWidgetEnabled { get; } | |||
/// <summary> | |||
/// Gets the default message notifications for users who haven't explicitly set their notification settings. | |||
/// </summary> | |||
DefaultMessageNotifications DefaultMessageNotifications { get; } | |||
@@ -64,31 +71,45 @@ namespace Discord | |||
/// Gets the ID of this guild's icon. | |||
/// </summary> | |||
/// <returns> | |||
/// An identifier for the splash image; <c>null</c> if none is set. | |||
/// An identifier for the splash image; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string IconId { get; } | |||
/// <summary> | |||
/// Gets the URL of this guild's icon. | |||
/// </summary> | |||
/// <returns> | |||
/// A URL pointing to the guild's icon; <c>null</c> if none is set. | |||
/// A URL pointing to the guild's icon; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string IconUrl { get; } | |||
/// <summary> | |||
/// Gets the ID of this guild's splash image. | |||
/// </summary> | |||
/// <returns> | |||
/// An identifier for the splash image; <c>null</c> if none is set. | |||
/// An identifier for the splash image; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string SplashId { get; } | |||
/// <summary> | |||
/// Gets the URL of this guild's splash image. | |||
/// </summary> | |||
/// <returns> | |||
/// A URL pointing to the guild's splash image; <c>null</c> if none is set. | |||
/// A URL pointing to the guild's splash image; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string SplashUrl { get; } | |||
/// <summary> | |||
/// Gets the ID of this guild's discovery splash image. | |||
/// </summary> | |||
/// <returns> | |||
/// An identifier for the discovery splash image; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string DiscoverySplashId { get; } | |||
/// <summary> | |||
/// Gets the URL of this guild's discovery splash image. | |||
/// </summary> | |||
/// <returns> | |||
/// A URL pointing to the guild's discovery splash image; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string DiscoverySplashUrl { get; } | |||
/// <summary> | |||
/// Determines if this guild is currently connected and ready to be used. | |||
/// </summary> | |||
/// <remarks> | |||
@@ -98,7 +119,7 @@ namespace Discord | |||
/// This boolean is used to determine if the guild is currently connected to the WebSocket and is ready to be used/accessed. | |||
/// </remarks> | |||
/// <returns> | |||
/// <c>true</c> if this guild is currently connected and ready to be used; otherwise <c>false</c>. | |||
/// <c>true</c> if this guild is currently connected and ready to be used; otherwise <see langword="false"/>. | |||
/// </returns> | |||
bool Available { get; } | |||
@@ -106,7 +127,7 @@ namespace Discord | |||
/// Gets the ID of the AFK voice channel for this guild. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see cref="ulong"/> representing the snowflake identifier of the AFK voice channel; <c>null</c> if | |||
/// A <see langword="ulong"/> representing the snowflake identifier of the AFK voice channel; <see langword="null" /> if | |||
/// none is set. | |||
/// </returns> | |||
ulong? AFKChannelId { get; } | |||
@@ -121,7 +142,7 @@ namespace Discord | |||
/// </note> | |||
/// </remarks> | |||
/// <returns> | |||
/// A <see cref="ulong"/> representing the snowflake identifier of the default text channel; <c>0</c> if | |||
/// A <see langword="ulong"/> representing the snowflake identifier of the default text channel; <c>0</c> if | |||
/// none can be found. | |||
/// </returns> | |||
ulong DefaultChannelId { get; } | |||
@@ -129,30 +150,54 @@ namespace Discord | |||
/// Gets the ID of the widget embed channel of this guild. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see cref="ulong"/> representing the snowflake identifier of the embedded channel found within the | |||
/// widget settings of this guild; <c>null</c> if none is set. | |||
/// A <see langword="ulong"/> representing the snowflake identifier of the embedded channel found within the | |||
/// widget settings of this guild; <see langword="null" /> if none is set. | |||
/// </returns> | |||
ulong? EmbedChannelId { get; } | |||
/// <summary> | |||
/// Gets the ID of the channel assigned to the widget of this guild. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see langword="ulong"/> representing the snowflake identifier of the channel assigned to the widget found | |||
/// within the widget settings of this guild; <see langword="null" /> if none is set. | |||
/// </returns> | |||
ulong? WidgetChannelId { get; } | |||
/// <summary> | |||
/// Gets the ID of the channel where randomized welcome messages are sent. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see cref="ulong"/> representing the snowflake identifier of the system channel where randomized | |||
/// welcome messages are sent; <c>null</c> if none is set. | |||
/// A <see langword="ulong"/> representing the snowflake identifier of the system channel where randomized | |||
/// welcome messages are sent; <see langword="null" /> if none is set. | |||
/// </returns> | |||
ulong? SystemChannelId { get; } | |||
/// <summary> | |||
/// Gets the ID of the channel with the rules. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see langword="ulong"/> representing the snowflake identifier of the channel that contains the rules; | |||
/// <see langword="null" /> if none is set. | |||
/// </returns> | |||
ulong? RulesChannelId { get; } | |||
/// <summary> | |||
/// Gets the ID of the channel where admins and moderators of Community guilds receive notices from Discord. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see langword="ulong"/> representing the snowflake identifier of the channel where admins and moderators | |||
/// of Community guilds receive notices from Discord; <see langword="null" /> if none is set. | |||
/// </returns> | |||
ulong? PublicUpdatesChannelId { get; } | |||
/// <summary> | |||
/// Gets the ID of the user that owns this guild. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see cref="ulong"/> representing the snowflake identifier of the user that owns this guild. | |||
/// A <see langword="ulong"/> representing the snowflake identifier of the user that owns this guild. | |||
/// </returns> | |||
ulong OwnerId { get; } | |||
/// <summary> | |||
/// Gets the application ID of the guild creator if it is bot-created. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see cref="ulong"/> representing the snowflake identifier of the application ID that created this guild, or <c>null</c> if it was not bot-created. | |||
/// A <see langword="ulong"/> representing the snowflake identifier of the application ID that created this guild, or <see langword="null" /> if it was not bot-created. | |||
/// </returns> | |||
ulong? ApplicationId { get; } | |||
/// <summary> | |||
@@ -208,21 +253,21 @@ namespace Discord | |||
/// Gets the identifier for this guilds banner image. | |||
/// </summary> | |||
/// <returns> | |||
/// An identifier for the banner image; <c>null</c> if none is set. | |||
/// An identifier for the banner image; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string BannerId { get; } | |||
/// <summary> | |||
/// Gets the URL of this guild's banner image. | |||
/// </summary> | |||
/// <returns> | |||
/// A URL pointing to the guild's banner image; <c>null</c> if none is set. | |||
/// A URL pointing to the guild's banner image; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string BannerUrl { get; } | |||
/// <summary> | |||
/// Gets the code for this guild's vanity invite URL. | |||
/// </summary> | |||
/// <returns> | |||
/// A string containing the vanity invite code for this guild; <c>null</c> if none is set. | |||
/// A string containing the vanity invite code for this guild; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string VanityURLCode { get; } | |||
/// <summary> | |||
@@ -236,7 +281,7 @@ namespace Discord | |||
/// Gets the description for the guild. | |||
/// </summary> | |||
/// <returns> | |||
/// The description for the guild; <c>null</c> if none is set. | |||
/// The description for the guild; <see langword="null" /> if none is set. | |||
/// </returns> | |||
string Description { get; } | |||
/// <summary> | |||
@@ -246,9 +291,50 @@ namespace Discord | |||
/// This is the number of users who have boosted this guild. | |||
/// </remarks> | |||
/// <returns> | |||
/// The number of premium subscribers of this guild. | |||
/// The number of premium subscribers of this guild; <see langword="null" /> if not available. | |||
/// </returns> | |||
int PremiumSubscriptionCount { get; } | |||
/// <summary> | |||
/// Gets the maximum number of presences for the guild. | |||
/// </summary> | |||
/// <returns> | |||
/// The maximum number of presences for the guild. | |||
/// </returns> | |||
int? MaxPresences { get; } | |||
/// <summary> | |||
/// Gets the maximum number of members for the guild. | |||
/// </summary> | |||
/// <returns> | |||
/// The maximum number of members for the guild. | |||
/// </returns> | |||
int? MaxMembers { get; } | |||
/// <summary> | |||
/// Gets the maximum amount of users in a video channel. | |||
/// </summary> | |||
/// <returns> | |||
/// The maximum amount of users in a video channel. | |||
/// </returns> | |||
int? MaxVideoChannelUsers { get; } | |||
/// <summary> | |||
/// Gets the approximate number of members in this guild. | |||
/// </summary> | |||
/// <remarks> | |||
/// Only available when getting a guild via REST when `with_counts` is true. | |||
/// </remarks> | |||
/// <returns> | |||
/// The approximate number of members in this guild. | |||
/// </returns> | |||
int? ApproximateMemberCount { get; } | |||
/// <summary> | |||
/// Gets the approximate number of non-offline members in this guild. | |||
/// </summary> | |||
/// <remarks> | |||
/// Only available when getting a guild via REST when `with_counts` is true. | |||
/// </remarks> | |||
/// <returns> | |||
/// The approximate number of non-offline members in this guild. | |||
/// </returns> | |||
int? ApproximatePresenceCount { get; } | |||
/// <summary> | |||
/// Gets the preferred locale of this guild in IETF BCP 47 | |||
@@ -285,8 +371,18 @@ namespace Discord | |||
/// <returns> | |||
/// A task that represents the asynchronous modification operation. | |||
/// </returns> | |||
[Obsolete("This endpoint is deprecated, use ModifyWidgetAsync instead.")] | |||
Task ModifyEmbedAsync(Action<GuildEmbedProperties> func, RequestOptions options = null); | |||
/// <summary> | |||
/// Modifies this guild's widget. | |||
/// </summary> | |||
/// <param name="func">The delegate containing the properties to modify the guild widget with.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous modification operation. | |||
/// </returns> | |||
Task ModifyWidgetAsync(Action<GuildWidgetProperties> func, RequestOptions options = null); | |||
/// <summary> | |||
/// Bulk-modifies the order of channels in this guild. | |||
/// </summary> | |||
/// <param name="args">The properties used to modify the channel positions with.</param> | |||
@@ -336,7 +432,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains a ban object, which | |||
/// contains the user information and the reason for the ban; <c>null</c> if the ban entry cannot be found. | |||
/// contains the user information and the reason for the ban; <see langword="null" /> if the ban entry cannot be found. | |||
/// </returns> | |||
Task<IBan> GetBanAsync(IUser user, RequestOptions options = null); | |||
/// <summary> | |||
@@ -346,7 +442,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains a ban object, which | |||
/// contains the user information and the reason for the ban; <c>null</c> if the ban entry cannot be found. | |||
/// contains the user information and the reason for the ban; <see langword="null" /> if the ban entry cannot be found. | |||
/// </returns> | |||
Task<IBan> GetBanAsync(ulong userId, RequestOptions options = null); | |||
/// <summary> | |||
@@ -410,7 +506,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the generic channel | |||
/// associated with the specified <paramref name="id"/>; <c>null</c> if none is found. | |||
/// associated with the specified <paramref name="id"/>; <see langword="null" /> if none is found. | |||
/// </returns> | |||
Task<IGuildChannel> GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
@@ -431,7 +527,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the text channel | |||
/// associated with the specified <paramref name="id"/>; <c>null</c> if none is found. | |||
/// associated with the specified <paramref name="id"/>; <see langword="null" /> if none is found. | |||
/// </returns> | |||
Task<ITextChannel> GetTextChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
@@ -462,7 +558,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the voice channel associated | |||
/// with the specified <paramref name="id"/>; <c>null</c> if none is found. | |||
/// with the specified <paramref name="id"/>; <see langword="null" /> if none is found. | |||
/// </returns> | |||
Task<IVoiceChannel> GetVoiceChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
@@ -472,7 +568,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the voice channel that the | |||
/// AFK users will be moved to after they have idled for too long; <c>null</c> if none is set. | |||
/// AFK users will be moved to after they have idled for too long; <see langword="null" /> if none is set. | |||
/// </returns> | |||
Task<IVoiceChannel> GetAFKChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
@@ -482,7 +578,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the text channel where | |||
/// randomized welcome messages will be sent to; <c>null</c> if none is set. | |||
/// randomized welcome messages will be sent to; <see langword="null" /> if none is set. | |||
/// </returns> | |||
Task<ITextChannel> GetSystemChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
@@ -492,7 +588,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the first viewable text | |||
/// channel in this guild; <c>null</c> if none is found. | |||
/// channel in this guild; <see langword="null" /> if none is found. | |||
/// </returns> | |||
Task<ITextChannel> GetDefaultChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
@@ -502,9 +598,40 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the embed channel set | |||
/// within the server's widget settings; <c>null</c> if none is set. | |||
/// within the server's widget settings; <see langword="null" /> if none is set. | |||
/// </returns> | |||
[Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")] | |||
Task<IGuildChannel> GetEmbedChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
/// Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild. | |||
/// </summary> | |||
/// <param name="mode">The <see cref="CacheMode" /> that determines whether the object should be fetched from cache.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the widget channel set | |||
/// within the server's widget settings; <see langword="null" /> if none is set. | |||
/// </returns> | |||
Task<IGuildChannel> GetWidgetChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
/// Gets the text channel where Community guilds can display rules and/or guidelines. | |||
/// </summary> | |||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the text channel | |||
/// where Community guilds can display rules and/or guidelines; <see langword="null" /> if none is set. | |||
/// </returns> | |||
Task<ITextChannel> GetRulesChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
/// Gets the text channel channel where admins and moderators of Community guilds receive notices from Discord. | |||
/// </summary> | |||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the text channel channel where | |||
/// admins and moderators of Community guilds receive notices from Discord; <see langword="null" /> if none is set. | |||
/// </returns> | |||
Task<ITextChannel> GetPublicUpdatesChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
/// Creates a new text channel in this guild. | |||
@@ -573,7 +700,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the partial metadata of | |||
/// the vanity invite found within this guild; <c>null</c> if none is found. | |||
/// the vanity invite found within this guild; <see langword="null" /> if none is found. | |||
/// </returns> | |||
Task<IInviteMetadata> GetVanityInviteAsync(RequestOptions options = null); | |||
@@ -582,7 +709,7 @@ namespace Discord | |||
/// </summary> | |||
/// <param name="id">The snowflake identifier for the role.</param> | |||
/// <returns> | |||
/// A role that is associated with the specified <paramref name="id"/>; <c>null</c> if none is found. | |||
/// A role that is associated with the specified <paramref name="id"/>; <see langword="null" /> if none is found. | |||
/// </returns> | |||
IRole GetRole(ulong id); | |||
/// <summary> | |||
@@ -624,7 +751,7 @@ namespace Discord | |||
/// <param name="accessToken">The OAuth2 access token for the user, requested with the guilds.join scope.</param> | |||
/// <param name="func">The delegate containing the properties to be applied to the user upon being added to the guild.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns>A guild user associated with the specified <paramref name="userId" />; <c>null</c> if the user is already in the guild.</returns> | |||
/// <returns>A guild user associated with the specified <paramref name="userId" />; <see langword="null" /> if the user is already in the guild.</returns> | |||
Task<IGuildUser> AddGuildUserAsync(ulong userId, string accessToken, Action<AddGuildUserProperties> func = null, RequestOptions options = null); | |||
/// <summary> | |||
/// Gets a collection of all users in this guild. | |||
@@ -649,7 +776,7 @@ namespace Discord | |||
/// <remarks> | |||
/// This method retrieves a user found within this guild. | |||
/// <note> | |||
/// This may return <c>null</c> in the WebSocket implementation due to incomplete user collection in | |||
/// This may return <see langword="null" /> in the WebSocket implementation due to incomplete user collection in | |||
/// large guilds. | |||
/// </note> | |||
/// </remarks> | |||
@@ -658,7 +785,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the guild user | |||
/// associated with the specified <paramref name="id"/>; <c>null</c> if none is found. | |||
/// associated with the specified <paramref name="id"/>; <see langword="null" /> if none is found. | |||
/// </returns> | |||
Task<IGuildUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
/// <summary> | |||
@@ -705,11 +832,12 @@ namespace Discord | |||
/// <param name="days">The number of days required for the users to be kicked.</param> | |||
/// <param name="simulate">Whether this prune action is a simulation.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <param name="includeRoleIds">An array of role IDs to be included in the prune of users who do not have any additional roles.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous prune operation. The task result contains the number of users to | |||
/// be or has been removed from this guild. | |||
/// </returns> | |||
Task<int> PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null); | |||
Task<int> PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null, IEnumerable<ulong> includeRoleIds = null); | |||
/// <summary> | |||
/// Gets a collection of users in this guild that the name or nickname starts with the | |||
/// provided <see cref="string"/> at <paramref name="query"/>. | |||
@@ -751,7 +879,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the webhook with the | |||
/// specified <paramref name="id"/>; <c>null</c> if none is found. | |||
/// specified <paramref name="id"/>; <see langword="null" /> if none is found. | |||
/// </returns> | |||
Task<IWebhook> GetWebhookAsync(ulong id, RequestOptions options = null); | |||
/// <summary> | |||
@@ -771,7 +899,7 @@ namespace Discord | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains the emote found with the | |||
/// specified <paramref name="id"/>; <c>null</c> if none is found. | |||
/// specified <paramref name="id"/>; <see langword="null" /> if none is found. | |||
/// </returns> | |||
Task<GuildEmote> GetEmoteAsync(ulong id, RequestOptions options = null); | |||
/// <summary> | |||
@@ -22,6 +22,18 @@ namespace Discord | |||
/// Gets the icon URL of the application. | |||
/// </summary> | |||
string IconUrl { get; } | |||
/// <summary> | |||
/// Gets if the bot is public. | |||
/// </summary> | |||
bool IsBotPublic { get; } | |||
/// <summary> | |||
/// Gets if the bot requires code grant. | |||
/// </summary> | |||
bool BotRequiresCodeGrant { get; } | |||
/// <summary> | |||
/// Gets the team associated with this application if there is one. | |||
/// </summary> | |||
ITeam Team { get; } | |||
/// <summary> | |||
/// Gets the partial user object containing info on the owner of the application. | |||
@@ -10,6 +10,7 @@ namespace Discord | |||
/// <summary> | |||
/// Updates this object's properties with its current state. | |||
/// </summary> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
Task UpdateAsync(RequestOptions options = null); | |||
} | |||
} |
@@ -20,6 +20,13 @@ namespace Discord | |||
/// </returns> | |||
string Url { get; } | |||
/// <summary> | |||
/// Gets the user that created this invite. | |||
/// </summary> | |||
/// <returns> | |||
/// A user that created this invite. | |||
/// </returns> | |||
IUser Inviter { get; } | |||
/// <summary> | |||
/// Gets the channel this invite is linked to. | |||
/// </summary> | |||
@@ -83,5 +90,19 @@ namespace Discord | |||
/// invite points to; <c>null</c> if one cannot be obtained. | |||
/// </returns> | |||
int? MemberCount { get; } | |||
/// <summary> | |||
/// Gets the user this invite is linked to via <see cref="TargetUserType"/>. | |||
/// </summary> | |||
/// <returns> | |||
/// A user that is linked to this invite. | |||
/// </returns> | |||
IUser TargetUser { get; } | |||
/// <summary> | |||
/// Gets the type of the linked <see cref="TargetUser"/> for this invite. | |||
/// </summary> | |||
/// <returns> | |||
/// The type of the linked user that is linked to this invite. | |||
/// </returns> | |||
TargetUserType TargetUserType { get; } | |||
} | |||
} |
@@ -8,28 +8,22 @@ namespace Discord | |||
public interface IInviteMetadata : IInvite | |||
{ | |||
/// <summary> | |||
/// Gets the user that created this invite. | |||
/// Gets a value that indicates whether the invite is a temporary one. | |||
/// </summary> | |||
/// <returns> | |||
/// A user that created this invite. | |||
/// <c>true</c> if users accepting this invite will be removed from the guild when they log off; otherwise | |||
/// <c>false</c>. | |||
/// </returns> | |||
IUser Inviter { get; } | |||
bool IsTemporary { get; } | |||
/// <summary> | |||
/// Gets a value that indicates whether the invite has been revoked. | |||
/// </summary> | |||
/// <returns> | |||
/// <c>true</c> if this invite was revoked; otherwise <c>false</c>. | |||
/// </returns> | |||
[Obsolete("This property doesn't exist anymore and shouldn't be used.")] | |||
bool IsRevoked { get; } | |||
/// <summary> | |||
/// Gets a value that indicates whether the invite is a temporary one. | |||
/// </summary> | |||
/// <returns> | |||
/// <c>true</c> if users accepting this invite will be removed from the guild when they log off; otherwise | |||
/// <c>false</c>. | |||
/// </returns> | |||
bool IsTemporary { get; } | |||
/// <summary> | |||
/// Gets the time (in seconds) until the invite expires. | |||
/// </summary> | |||
/// <returns> | |||
@@ -0,0 +1,14 @@ | |||
namespace Discord | |||
{ | |||
public enum TargetUserType | |||
{ | |||
/// <summary> | |||
/// The invite whose target user type is not defined. | |||
/// </summary> | |||
Undefined = 0, | |||
/// <summary> | |||
/// The invite is for a Go Live stream. | |||
/// </summary> | |||
Stream = 1 | |||
} | |||
} |
@@ -49,6 +49,14 @@ namespace Discord | |||
/// </summary> | |||
public List<ulong> UserIds { get; set; } = new List<ulong>(); | |||
/// <summary> | |||
/// Gets or sets whether to mention the author of the message you are replying to or not. | |||
/// </summary> | |||
/// <remarks> | |||
/// Specifically for inline replies. | |||
/// </remarks> | |||
public bool? MentionRepliedUser { get; set; } = null; | |||
/// <summary> | |||
/// Initializes a new instance of the <see cref="AllowedMentions"/> class. | |||
/// </summary> | |||
@@ -39,6 +39,13 @@ namespace Discord | |||
/// </returns> | |||
bool IsSuppressed { get; } | |||
/// <summary> | |||
/// Gets the value that indicates whether this message mentioned everyone. | |||
/// </summary> | |||
/// <returns> | |||
/// <c>true</c> if this message mentioned everyone; otherwise <c>false</c>. | |||
/// </returns> | |||
bool MentionedEveryone { get; } | |||
/// <summary> | |||
/// Gets the content for this message. | |||
/// </summary> | |||
/// <returns> | |||
@@ -85,10 +92,10 @@ namespace Discord | |||
/// Gets all embeds included in this message. | |||
/// </summary> | |||
/// <remarks> | |||
/// </remarks> | |||
/// This property gets a read-only collection of embeds associated with this message. Depending on the | |||
/// message, a sent message may contain one or more embeds. This is usually true when multiple link previews | |||
/// are generated; however, only one <see cref="EmbedType.Rich"/> <see cref="Embed"/> can be featured. | |||
/// </remarks> | |||
/// <returns> | |||
/// A read-only collection of embed objects. | |||
/// </returns> | |||
@@ -141,11 +148,11 @@ namespace Discord | |||
MessageApplication Application { get; } | |||
/// <summary> | |||
/// Gets the reference to the original message if it was crossposted. | |||
/// Gets the reference to the original message if it is a crosspost, channel follow add, pin, or reply message. | |||
/// </summary> | |||
/// <remarks> | |||
/// Sent with Cross-posted messages, meaning they were published from news channels | |||
/// and received by subscriber channels. | |||
/// Sent with cross-posted messages, meaning they were published from news channels | |||
/// and received by subscriber channels, channel follow adds, pins, and message replies. | |||
/// </remarks> | |||
/// <returns> | |||
/// A message's reference, if any is associated. | |||
@@ -157,6 +164,17 @@ namespace Discord | |||
/// </summary> | |||
IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions { get; } | |||
/// <summary> | |||
/// Gets the flags related to this message. | |||
/// </summary> | |||
/// <remarks> | |||
/// This value is determined by bitwise OR-ing <see cref="MessageFlags"/> values together. | |||
/// </remarks> | |||
/// <returns> | |||
/// A message's flags, if any is associated. | |||
/// </returns> | |||
MessageFlags? Flags { get; } | |||
/// <summary> | |||
/// Adds a reaction to this message. | |||
/// </summary> | |||
@@ -1,5 +1,4 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Threading.Tasks; | |||
namespace Discord | |||
@@ -9,6 +8,14 @@ namespace Discord | |||
/// </summary> | |||
public interface IUserMessage : IMessage | |||
{ | |||
/// <summary> | |||
/// Gets the referenced message if it is a crosspost, channel follow add, pin, or reply message. | |||
/// </summary> | |||
/// <returns> | |||
/// The referenced message, if any is associated and still exists. | |||
/// </returns> | |||
IUserMessage ReferencedMessage { get; } | |||
/// <summary> | |||
/// Modifies this message. | |||
/// </summary> | |||
@@ -0,0 +1,36 @@ | |||
using System; | |||
namespace Discord | |||
{ | |||
[Flags] | |||
public enum MessageFlags | |||
{ | |||
/// <summary> | |||
/// Default value for flags, when none are given to a message. | |||
/// </summary> | |||
None = 0, | |||
/// <summary> | |||
/// Flag given to messages that have been published to subscribed | |||
/// channels (via Channel Following). | |||
/// </summary> | |||
Crossposted = 1 << 0, | |||
/// <summary> | |||
/// Flag given to messages that originated from a message in another | |||
/// channel (via Channel Following). | |||
/// </summary> | |||
IsCrosspost = 1 << 1, | |||
/// <summary> | |||
/// Flag given to messages that do not display any embeds. | |||
/// </summary> | |||
SuppressEmbeds = 1 << 2, | |||
/// <summary> | |||
/// Flag given to messages that the source message for this crosspost | |||
/// has been deleted (via Channel Following). | |||
/// </summary> | |||
SourceMessageDeleted = 1 << 3, | |||
/// <summary> | |||
/// Flag given to messages that came from the urgent message system. | |||
/// </summary> | |||
Urgent = 1 << 4, | |||
} | |||
} |
@@ -21,5 +21,17 @@ namespace Discord | |||
/// Gets or sets the embed the message should display. | |||
/// </summary> | |||
public Optional<Embed> Embed { get; set; } | |||
/// <summary> | |||
/// Gets or sets the flags of the message. | |||
/// </summary> | |||
/// <remarks> | |||
/// Only <see cref="MessageFlags.SuppressEmbeds"/> can be set/unset and you need to be | |||
/// the author of the message. | |||
/// </remarks> | |||
public Optional<MessageFlags?> Flags { get; set; } | |||
/// <summary> | |||
/// Gets or sets the allowed mentions of the message. | |||
/// </summary> | |||
public Optional<AllowedMentions> AllowedMentions { get; set; } | |||
} | |||
} |
@@ -3,7 +3,7 @@ using System.Diagnostics; | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
/// Contains the IDs sent from a crossposted message. | |||
/// Contains the IDs sent from a crossposted message or inline reply. | |||
/// </summary> | |||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | |||
public class MessageReference | |||
@@ -16,13 +16,36 @@ namespace Discord | |||
/// <summary> | |||
/// Gets the Channel ID of the original message. | |||
/// </summary> | |||
public ulong ChannelId { get; internal set; } | |||
/// <remarks> | |||
/// It only will be the default value (zero) if it was instantiated with a <see langword="null"/> in the constructor. | |||
/// </remarks> | |||
public ulong ChannelId { get => InternalChannelId.GetValueOrDefault(); } | |||
internal Optional<ulong> InternalChannelId; | |||
/// <summary> | |||
/// Gets the Guild ID of the original message. | |||
/// </summary> | |||
public Optional<ulong> GuildId { get; internal set; } | |||
/// <summary> | |||
/// Initializes a new instance of the <see cref="MessageReference"/> class. | |||
/// </summary> | |||
/// <param name="messageId"> | |||
/// The ID of the message that will be referenced. Used to reply to specific messages and the only parameter required for it. | |||
/// </param> | |||
/// <param name="channelId"> | |||
/// The ID of the channel that will be referenced. It will be validated if sent. | |||
/// </param> | |||
/// <param name="guildId"> | |||
/// The ID of the guild that will be referenced. It will be validated if sent. | |||
/// </param> | |||
public MessageReference(ulong? messageId = null, ulong? channelId = null, ulong? guildId = null) | |||
{ | |||
MessageId = messageId ?? Optional.Create<ulong>(); | |||
InternalChannelId = channelId ?? Optional.Create<ulong>(); | |||
GuildId = guildId ?? Optional.Create<ulong>(); | |||
} | |||
private string DebuggerDisplay | |||
=> $"Channel ID: ({ChannelId}){(GuildId.IsSpecified ? $", Guild ID: ({GuildId.Value})" : "")}" + | |||
$"{(MessageId.IsSpecified ? $", Message ID: ({MessageId.Value})" : "")}"; | |||
@@ -57,5 +57,12 @@ namespace Discord | |||
/// The message for when a news channel subscription is added to a text channel. | |||
/// </summary> | |||
ChannelFollowAdd = 12, | |||
/// <summary> | |||
/// The message is an inline reply. | |||
/// </summary> | |||
/// <remarks> | |||
/// Only available in API v8. | |||
/// </remarks> | |||
Reply = 19, | |||
} | |||
} |
@@ -17,7 +17,7 @@ namespace Discord | |||
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for category channels. </summary> | |||
public static readonly ChannelPermissions Category = new ChannelPermissions(0b01100_1111110_1111111110001_010001); | |||
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for direct message channels. </summary> | |||
public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110000_000000); | |||
public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110001_000000); | |||
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for group channels. </summary> | |||
public static readonly ChannelPermissions Group = new ChannelPermissions(0b00000_1000110_0001101100000_000000); | |||
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for a given channel type. </summary> | |||
@@ -51,6 +51,10 @@ namespace Discord | |||
/// authentication when used on a guild that has server-wide 2FA enabled. | |||
/// </remarks> | |||
ManageGuild = 0x00_00_00_20, | |||
/// <summary> | |||
/// Allows for viewing of guild insights | |||
/// </summary> | |||
ViewGuildInsights = 0x00_08_00_00, | |||
// Text | |||
/// <summary> | |||
@@ -12,7 +12,7 @@ namespace Discord | |||
/// <summary> Gets a <see cref="GuildPermissions"/> that grants all guild permissions for webhook users. </summary> | |||
public static readonly GuildPermissions Webhook = new GuildPermissions(0b00000_0000000_0001101100000_000000); | |||
/// <summary> Gets a <see cref="GuildPermissions"/> that grants all guild permissions. </summary> | |||
public static readonly GuildPermissions All = new GuildPermissions(0b11111_1111110_1111111111111_111111); | |||
public static readonly GuildPermissions All = new GuildPermissions(0b11111_1111111_1111111111111_111111); | |||
/// <summary> Gets a packed value representing all the permissions in this <see cref="GuildPermissions"/>. </summary> | |||
public ulong RawValue { get; } | |||
@@ -34,6 +34,8 @@ namespace Discord | |||
public bool AddReactions => Permissions.GetValue(RawValue, GuildPermission.AddReactions); | |||
/// <summary> If <c>true</c>, a user may view the audit log. </summary> | |||
public bool ViewAuditLog => Permissions.GetValue(RawValue, GuildPermission.ViewAuditLog); | |||
/// <summary> If <c>true</c>, a user may view the guild insights. </summary> | |||
public bool ViewGuildInsights => Permissions.GetValue(RawValue, GuildPermission.ViewGuildInsights); | |||
/// <summary> If True, a user may join channels. </summary> | |||
[Obsolete("Use ViewChannel instead.")] | |||
@@ -97,6 +99,7 @@ namespace Discord | |||
bool? manageGuild = null, | |||
bool? addReactions = null, | |||
bool? viewAuditLog = null, | |||
bool? viewGuildInsights = null, | |||
bool? viewChannel = null, | |||
bool? sendMessages = null, | |||
bool? sendTTSMessages = null, | |||
@@ -130,6 +133,7 @@ namespace Discord | |||
Permissions.SetValue(ref value, manageGuild, GuildPermission.ManageGuild); | |||
Permissions.SetValue(ref value, addReactions, GuildPermission.AddReactions); | |||
Permissions.SetValue(ref value, viewAuditLog, GuildPermission.ViewAuditLog); | |||
Permissions.SetValue(ref value, viewGuildInsights, GuildPermission.ViewGuildInsights); | |||
Permissions.SetValue(ref value, viewChannel, GuildPermission.ViewChannel); | |||
Permissions.SetValue(ref value, sendMessages, GuildPermission.SendMessages); | |||
Permissions.SetValue(ref value, sendTTSMessages, GuildPermission.SendTTSMessages); | |||
@@ -166,6 +170,7 @@ namespace Discord | |||
bool manageGuild = false, | |||
bool addReactions = false, | |||
bool viewAuditLog = false, | |||
bool viewGuildInsights = false, | |||
bool viewChannel = false, | |||
bool sendMessages = false, | |||
bool sendTTSMessages = false, | |||
@@ -198,6 +203,7 @@ namespace Discord | |||
manageGuild: manageGuild, | |||
addReactions: addReactions, | |||
viewAuditLog: viewAuditLog, | |||
viewGuildInsights: viewGuildInsights, | |||
viewChannel: viewChannel, | |||
sendMessages: sendMessages, | |||
sendTTSMessages: sendTTSMessages, | |||
@@ -231,6 +237,7 @@ namespace Discord | |||
bool? manageGuild = null, | |||
bool? addReactions = null, | |||
bool? viewAuditLog = null, | |||
bool? viewGuildInsights = null, | |||
bool? viewChannel = null, | |||
bool? sendMessages = null, | |||
bool? sendTTSMessages = null, | |||
@@ -254,7 +261,7 @@ namespace Discord | |||
bool? manageWebhooks = null, | |||
bool? manageEmojis = null) | |||
=> new GuildPermissions(RawValue, createInstantInvite, kickMembers, banMembers, administrator, manageChannels, manageGuild, addReactions, | |||
viewAuditLog, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles, | |||
viewAuditLog, viewGuildInsights, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles, | |||
readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers, | |||
useVoiceActivation, prioritySpeaker, stream, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojis); | |||
@@ -76,6 +76,10 @@ namespace Discord | |||
public PermValue MoveMembers => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.MoveMembers); | |||
/// <summary> If Allowed, a user may use voice-activity-detection rather than push-to-talk. </summary> | |||
public PermValue UseVAD => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseVAD); | |||
/// <summary> If Allowed, a user may use priority speaker in a voice channel. </summary> | |||
public PermValue PrioritySpeaker => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.PrioritySpeaker); | |||
/// <summary> If Allowed, a user may go live in a voice channel. </summary> | |||
public PermValue Stream => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.Stream); | |||
/// <summary> If Allowed, a user may adjust role permissions. This also implicitly grants all other permissions. </summary> | |||
public PermValue ManageRoles => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageRoles); | |||
@@ -109,7 +113,9 @@ namespace Discord | |||
PermValue? moveMembers = null, | |||
PermValue? useVoiceActivation = null, | |||
PermValue? manageRoles = null, | |||
PermValue? manageWebhooks = null) | |||
PermValue? manageWebhooks = null, | |||
PermValue? prioritySpeaker = null, | |||
PermValue? stream = null) | |||
{ | |||
Permissions.SetValue(ref allowValue, ref denyValue, createInstantInvite, ChannelPermission.CreateInstantInvite); | |||
Permissions.SetValue(ref allowValue, ref denyValue, manageChannel, ChannelPermission.ManageChannels); | |||
@@ -129,6 +135,8 @@ namespace Discord | |||
Permissions.SetValue(ref allowValue, ref denyValue, deafenMembers, ChannelPermission.DeafenMembers); | |||
Permissions.SetValue(ref allowValue, ref denyValue, moveMembers, ChannelPermission.MoveMembers); | |||
Permissions.SetValue(ref allowValue, ref denyValue, useVoiceActivation, ChannelPermission.UseVAD); | |||
Permissions.SetValue(ref allowValue, ref denyValue, prioritySpeaker, ChannelPermission.PrioritySpeaker); | |||
Permissions.SetValue(ref allowValue, ref denyValue, stream, ChannelPermission.Stream); | |||
Permissions.SetValue(ref allowValue, ref denyValue, manageRoles, ChannelPermission.ManageRoles); | |||
Permissions.SetValue(ref allowValue, ref denyValue, manageWebhooks, ChannelPermission.ManageWebhooks); | |||
@@ -159,10 +167,12 @@ namespace Discord | |||
PermValue moveMembers = PermValue.Inherit, | |||
PermValue useVoiceActivation = PermValue.Inherit, | |||
PermValue manageRoles = PermValue.Inherit, | |||
PermValue manageWebhooks = PermValue.Inherit) | |||
PermValue manageWebhooks = PermValue.Inherit, | |||
PermValue prioritySpeaker = PermValue.Inherit, | |||
PermValue stream = PermValue.Inherit) | |||
: this(0, 0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages, | |||
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, | |||
moveMembers, useVoiceActivation, manageRoles, manageWebhooks) { } | |||
moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream) { } | |||
/// <summary> | |||
/// Initializes a new <see cref="OverwritePermissions" /> from the current one, changing the provided | |||
@@ -188,10 +198,12 @@ namespace Discord | |||
PermValue? moveMembers = null, | |||
PermValue? useVoiceActivation = null, | |||
PermValue? manageRoles = null, | |||
PermValue? manageWebhooks = null) | |||
PermValue? manageWebhooks = null, | |||
PermValue? prioritySpeaker = null, | |||
PermValue? stream = null) | |||
=> new OverwritePermissions(AllowValue, DenyValue, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages, | |||
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, | |||
moveMembers, useVoiceActivation, manageRoles, manageWebhooks); | |||
moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream); | |||
/// <summary> | |||
/// Creates a <see cref="List{T}"/> of all the <see cref="ChannelPermission"/> values that are allowed. | |||
@@ -65,6 +65,13 @@ namespace Discord | |||
/// An <see cref="int"/> representing the position of the role in the role list of the guild. | |||
/// </returns> | |||
int Position { get; } | |||
/// <summary> | |||
/// Gets the tags related to this role. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see cref="RoleTags"/> object containing all tags related to this role. | |||
/// </returns> | |||
RoleTags Tags { get; } | |||
/// <summary> | |||
/// Modifies this role. | |||
@@ -0,0 +1,40 @@ | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
/// Provides tags related to a discord role. | |||
/// </summary> | |||
public class RoleTags | |||
{ | |||
/// <summary> | |||
/// Gets the identifier of the bot that this role belongs to, if it does. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see langword="ulong"/> if this role belongs to a bot; otherwise | |||
/// <see langword="null"/>. | |||
/// </returns> | |||
public ulong? BotId { get; } | |||
/// <summary> | |||
/// Gets the identifier of the integration that this role belongs to, if it does. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see langword="ulong"/> if this role belongs to an integration; otherwise | |||
/// <see langword="null"/>. | |||
/// </returns> | |||
public ulong? IntegrationId { get; } | |||
/// <summary> | |||
/// Gets if this role is the guild's premium subscriber (booster) role. | |||
/// </summary> | |||
/// <returns> | |||
/// <see langword="true"/> if this role is the guild's premium subscriber role; | |||
/// otherwise <see langword="false"/>. | |||
/// </returns> | |||
public bool IsPremiumSubscriberRole { get; } | |||
internal RoleTags(ulong? botId, ulong? integrationId, bool isPremiumSubscriber) | |||
{ | |||
BotId = botId; | |||
IntegrationId = integrationId; | |||
IsPremiumSubscriberRole = isPremiumSubscriber; | |||
} | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using System.Collections.Generic; | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
/// Represents a Discord Team. | |||
/// </summary> | |||
public interface ITeam | |||
{ | |||
/// <summary> | |||
/// Gets the team icon url. | |||
/// </summary> | |||
string IconUrl { get; } | |||
/// <summary> | |||
/// Gets the team unique identifier. | |||
/// </summary> | |||
ulong Id { get; } | |||
/// <summary> | |||
/// Gets the members of this team. | |||
/// </summary> | |||
IReadOnlyList<ITeamMember> TeamMembers { get; } | |||
/// <summary> | |||
/// Gets the user identifier that owns this team. | |||
/// </summary> | |||
ulong OwnerUserId { get; } | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
/// Represents a Discord Team member. | |||
/// </summary> | |||
public interface ITeamMember | |||
{ | |||
/// <summary> | |||
/// Gets the membership state of this team member. | |||
/// </summary> | |||
MembershipState MembershipState { get; } | |||
/// <summary> | |||
/// Gets the permissions of this team member. | |||
/// </summary> | |||
string[] Permissions { get; } | |||
/// <summary> | |||
/// Gets the team unique identifier for this team member. | |||
/// </summary> | |||
ulong TeamId { get; } | |||
/// <summary> | |||
/// Gets the Discord user of this team member. | |||
/// </summary> | |||
IUser User { get; } | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
namespace Discord | |||
{ | |||
/// <summary> | |||
/// Represents the membership state of a team member. | |||
/// </summary> | |||
public enum MembershipState | |||
{ | |||
Invited, | |||
Accepted, | |||
} | |||
} |
@@ -68,12 +68,17 @@ namespace Discord | |||
/// </returns> | |||
IReadOnlyCollection<ulong> RoleIds { get; } | |||
/// <summary> | |||
/// Whether the user has passed the guild's Membership Screening requirements. | |||
/// </summary> | |||
bool? IsPending { get; } | |||
/// <summary> | |||
/// Gets the level permissions granted to this user to a given channel. | |||
/// </summary> | |||
/// <example> | |||
/// <para>The following example checks if the current user has the ability to send a message with attachment in | |||
/// this channel; if so, uploads a file via <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions)"/>.</para> | |||
/// this channel; if so, uploads a file via <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference)"/>.</para> | |||
/// <code language="cs"> | |||
/// if (currentUser?.GetPermissions(targetChannel)?.AttachFiles) | |||
/// await targetChannel.SendFileAsync("fortnite.png"); | |||
@@ -19,5 +19,9 @@ namespace Discord | |||
/// Gets the set of clients where this user is currently active. | |||
/// </summary> | |||
IImmutableSet<ClientType> ActiveClients { get; } | |||
/// <summary> | |||
/// Gets the list of activities that this user currently has available. | |||
/// </summary> | |||
IImmutableList<IActivity> Activities { get; } | |||
} | |||
} |
@@ -75,6 +75,16 @@ namespace Discord | |||
/// Gets the username for this user. | |||
/// </summary> | |||
string Username { get; } | |||
/// <summary> | |||
/// Gets the public flags that are applied to this user's account. | |||
/// </summary> | |||
/// <remarks> | |||
/// This value is determined by bitwise OR-ing <see cref="UserProperties"/> values together. | |||
/// </remarks> | |||
/// <returns> | |||
/// The value of public flags for this user. | |||
/// </returns> | |||
UserProperties? PublicFlags { get; } | |||
/// <summary> | |||
/// Gets the direct message channel of this user, or create one if it does not already exist. | |||
@@ -10,32 +10,62 @@ namespace Discord | |||
/// </summary> | |||
None = 0, | |||
/// <summary> | |||
/// Flag given to Discord staff. | |||
/// Flag given to users who are a Discord employee. | |||
/// </summary> | |||
Staff = 0b1, | |||
Staff = 1 << 0, | |||
/// <summary> | |||
/// Flag given to Discord partners. | |||
/// Flag given to users who are owners of a partnered Discord server. | |||
/// </summary> | |||
Partner = 0b10, | |||
Partner = 1 << 1, | |||
/// <summary> | |||
/// Flag given to users in HypeSquad events. | |||
/// </summary> | |||
HypeSquadEvents = 1 << 2, | |||
/// <summary> | |||
/// Flag given to users who have participated in the bug report program. | |||
/// This flag is obsolete, use <see cref="BugHunterLevel1"/> instead. | |||
/// </summary> | |||
[Obsolete("Use BugHunterLevel1 instead.")] | |||
BugHunter = 1 << 3, | |||
/// <summary> | |||
/// Flag given to users who have participated in the bug report program and are level 1. | |||
/// </summary> | |||
BugHunter = 0b1000, | |||
BugHunterLevel1 = 1 << 3, | |||
/// <summary> | |||
/// Flag given to users who are in the HypeSquad House of Bravery. | |||
/// </summary> | |||
HypeSquadBravery = 0b100_0000, | |||
HypeSquadBravery = 1 << 6, | |||
/// <summary> | |||
/// Flag given to users who are in the HypeSquad House of Brilliance. | |||
/// </summary> | |||
HypeSquadBrilliance = 0b1000_0000, | |||
HypeSquadBrilliance = 1 << 7, | |||
/// <summary> | |||
/// Flag given to users who are in the HypeSquad House of Balance. | |||
/// </summary> | |||
HypeSquadBalance = 0b1_0000_0000, | |||
HypeSquadBalance = 1 << 8, | |||
/// <summary> | |||
/// Flag given to users who subscribed to Nitro before games were added. | |||
/// </summary> | |||
EarlySupporter = 0b10_0000_0000, | |||
EarlySupporter = 1 << 9, | |||
/// <summary> | |||
/// Flag given to users who are part of a team. | |||
/// </summary> | |||
TeamUser = 1 << 10, | |||
/// <summary> | |||
/// Flag given to users who represent Discord (System). | |||
/// </summary> | |||
System = 1 << 12, | |||
/// <summary> | |||
/// Flag given to users who have participated in the bug report program and are level 2. | |||
/// </summary> | |||
BugHunterLevel2 = 1 << 14, | |||
/// <summary> | |||
/// Flag given to users who are verified bots. | |||
/// </summary> | |||
VerifiedBot = 1 << 16, | |||
/// <summary> | |||
/// Flag given to users that developed bots and early verified their accounts. | |||
/// </summary> | |||
EarlyVerifiedBotDeveloper = 1 << 17, | |||
} | |||
} |
@@ -17,7 +17,7 @@ namespace Discord | |||
public static string GetJumpUrl(this IMessage msg) | |||
{ | |||
var channel = msg.Channel; | |||
return $"https://discordapp.com/channels/{(channel is IDMChannel ? "@me" : $"{(channel as ITextChannel).GuildId}")}/{channel.Id}/{msg.Id}"; | |||
return $"https://discord.com/channels/{(channel is IDMChannel ? "@me" : $"{(channel as ITextChannel).GuildId}")}/{channel.Id}/{msg.Id}"; | |||
} | |||
/// <summary> | |||
@@ -71,5 +71,25 @@ namespace Discord | |||
foreach (var rxn in reactions) | |||
await msg.RemoveReactionAsync(rxn, user, options).ConfigureAwait(false); | |||
} | |||
/// <summary> | |||
/// Sends an inline reply that references a message. | |||
/// </summary> | |||
/// <param name="text">The message to be sent.</param> | |||
/// <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param> | |||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||
/// <param name="allowedMentions"> | |||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | |||
/// If <c>null</c>, all mentioned roles and users will be notified. | |||
/// </param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents an asynchronous send operation for delivering the message. The task result | |||
/// contains the sent message. | |||
/// </returns> | |||
public static async Task<IUserMessage> ReplyAsync(this IUserMessage msg, string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null) | |||
{ | |||
return await msg.Channel.SendMessageAsync(text, isTTS, embed, options, allowedMentions, new MessageReference(messageId: msg.Id)).ConfigureAwait(false); | |||
} | |||
} | |||
} |
@@ -274,5 +274,15 @@ namespace Discord | |||
/// that represents the number of shards that should be used with this account. | |||
/// </returns> | |||
Task<int> GetRecommendedShardCountAsync(RequestOptions options = null); | |||
/// <summary> | |||
/// Gets the gateway information related to the bot. | |||
/// </summary> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation. The task result contains a <see cref="BotGateway"/> | |||
/// that represents the gateway information related to the bot. | |||
/// </returns> | |||
Task<BotGateway> GetBotGatewayAsync(RequestOptions options = null); | |||
} | |||
} |
@@ -0,0 +1,118 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.Immutable; | |||
using System.Linq; | |||
namespace Discord.Net | |||
{ | |||
/// <summary> | |||
/// Represents a ratelimit bucket. | |||
/// </summary> | |||
public class BucketId : IEquatable<BucketId> | |||
{ | |||
/// <summary> | |||
/// Gets the http method used to make the request if available. | |||
/// </summary> | |||
public string HttpMethod { get; } | |||
/// <summary> | |||
/// Gets the endpoint that is going to be requested if available. | |||
/// </summary> | |||
public string Endpoint { get; } | |||
/// <summary> | |||
/// Gets the major parameters of the route. | |||
/// </summary> | |||
public IOrderedEnumerable<KeyValuePair<string, string>> MajorParameters { get; } | |||
/// <summary> | |||
/// Gets the hash of this bucket. | |||
/// </summary> | |||
/// <remarks> | |||
/// The hash is provided by Discord to group ratelimits. | |||
/// </remarks> | |||
public string BucketHash { get; } | |||
/// <summary> | |||
/// Gets if this bucket is a hash type. | |||
/// </summary> | |||
public bool IsHashBucket { get => BucketHash != null; } | |||
private BucketId(string httpMethod, string endpoint, IEnumerable<KeyValuePair<string, string>> majorParameters, string bucketHash) | |||
{ | |||
HttpMethod = httpMethod; | |||
Endpoint = endpoint; | |||
MajorParameters = majorParameters.OrderBy(x => x.Key); | |||
BucketHash = bucketHash; | |||
} | |||
/// <summary> | |||
/// Creates a new <see cref="BucketId"/> based on the | |||
/// <see cref="HttpMethod"/> and <see cref="Endpoint"/>. | |||
/// </summary> | |||
/// <param name="httpMethod">Http method used to make the request.</param> | |||
/// <param name="endpoint">Endpoint that is going to receive requests.</param> | |||
/// <param name="majorParams">Major parameters of the route of this endpoint.</param> | |||
/// <returns> | |||
/// A <see cref="BucketId"/> based on the <see cref="HttpMethod"/> | |||
/// and the <see cref="Endpoint"/> with the provided data. | |||
/// </returns> | |||
public static BucketId Create(string httpMethod, string endpoint, Dictionary<string, string> majorParams) | |||
{ | |||
Preconditions.NotNullOrWhitespace(endpoint, nameof(endpoint)); | |||
majorParams ??= new Dictionary<string, string>(); | |||
return new BucketId(httpMethod, endpoint, majorParams, null); | |||
} | |||
/// <summary> | |||
/// Creates a new <see cref="BucketId"/> based on a | |||
/// <see cref="BucketHash"/> and a previous <see cref="BucketId"/>. | |||
/// </summary> | |||
/// <param name="hash">Bucket hash provided by Discord.</param> | |||
/// <param name="oldBucket"><see cref="BucketId"/> that is going to be upgraded to a hash type.</param> | |||
/// <returns> | |||
/// A <see cref="BucketId"/> based on the <see cref="BucketHash"/> | |||
/// and <see cref="MajorParameters"/>. | |||
/// </returns> | |||
public static BucketId Create(string hash, BucketId oldBucket) | |||
{ | |||
Preconditions.NotNullOrWhitespace(hash, nameof(hash)); | |||
Preconditions.NotNull(oldBucket, nameof(oldBucket)); | |||
return new BucketId(null, null, oldBucket.MajorParameters, hash); | |||
} | |||
/// <summary> | |||
/// Gets the string that will define this bucket as a hash based one. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see cref="string"/> that defines this bucket as a hash based one. | |||
/// </returns> | |||
public string GetBucketHash() | |||
=> IsHashBucket ? $"{BucketHash}:{string.Join("/", MajorParameters.Select(x => x.Value))}" : null; | |||
/// <summary> | |||
/// Gets the string that will define this bucket as an endpoint based one. | |||
/// </summary> | |||
/// <returns> | |||
/// A <see cref="string"/> that defines this bucket as an endpoint based one. | |||
/// </returns> | |||
public string GetUniqueEndpoint() | |||
=> HttpMethod != null ? $"{HttpMethod} {Endpoint}" : Endpoint; | |||
public override bool Equals(object obj) | |||
=> Equals(obj as BucketId); | |||
public override int GetHashCode() | |||
=> IsHashBucket ? (BucketHash, string.Join("/", MajorParameters.Select(x => x.Value))).GetHashCode() : (HttpMethod, Endpoint).GetHashCode(); | |||
public override string ToString() | |||
=> GetBucketHash() ?? GetUniqueEndpoint(); | |||
public bool Equals(BucketId other) | |||
{ | |||
if (other is null) | |||
return false; | |||
if (ReferenceEquals(this, other)) | |||
return true; | |||
if (GetType() != other.GetType()) | |||
return false; | |||
return ToString() == other.ToString(); | |||
} | |||
} | |||
} |
@@ -13,7 +13,7 @@ namespace Discord.Net | |||
/// </summary> | |||
/// <returns> | |||
/// An | |||
/// <see href="https://discordapp.com/developers/docs/topics/opcodes-and-status-codes#http">HTTP status code</see> | |||
/// <see href="https://discord.com/developers/docs/topics/opcodes-and-status-codes#http">HTTP status code</see> | |||
/// from Discord. | |||
/// </returns> | |||
public HttpStatusCode HttpCode { get; } | |||
@@ -22,7 +22,7 @@ namespace Discord.Net | |||
/// </summary> | |||
/// <returns> | |||
/// A | |||
/// <see href="https://discordapp.com/developers/docs/topics/opcodes-and-status-codes#json">JSON error code</see> | |||
/// <see href="https://discord.com/developers/docs/topics/opcodes-and-status-codes#json">JSON error code</see> | |||
/// from Discord, or <c>null</c> if none. | |||
/// </returns> | |||
public int? DiscordCode { get; } | |||
@@ -11,7 +11,7 @@ namespace Discord.Net | |||
/// </summary> | |||
/// <returns> | |||
/// A | |||
/// <see href="https://discordapp.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes">close code</see> | |||
/// <see href="https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes">close code</see> | |||
/// from Discord. | |||
/// </returns> | |||
public int CloseCode { get; } | |||
@@ -1,3 +1,4 @@ | |||
using Discord.Net; | |||
using System.Threading; | |||
namespace Discord | |||
@@ -57,9 +58,10 @@ namespace Discord | |||
public bool? UseSystemClock { get; set; } | |||
internal bool IgnoreState { get; set; } | |||
internal string BucketId { get; set; } | |||
internal BucketId BucketId { get; set; } | |||
internal bool IsClientBucket { get; set; } | |||
internal bool IsReactionBucket { get; set; } | |||
internal bool IsGatewayBucket { get; set; } | |||
internal static RequestOptions CreateOrClone(RequestOptions options) | |||
{ | |||
@@ -2,7 +2,7 @@ using Newtonsoft.Json; | |||
namespace Discord.API | |||
{ | |||
public class AllowedMentions | |||
internal class AllowedMentions | |||
{ | |||
[JsonProperty("parse")] | |||
public Optional<string[]> Parse { get; set; } | |||
@@ -11,5 +11,7 @@ namespace Discord.API | |||
public Optional<ulong[]> Roles { get; set; } | |||
[JsonProperty("users")] | |||
public Optional<ulong[]> Users { get; set; } | |||
[JsonProperty("replied_user")] | |||
public Optional<bool> RepliedUser { get; set; } | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
#pragma warning disable CS1591 | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API | |||
@@ -15,6 +15,12 @@ namespace Discord.API | |||
public ulong Id { get; set; } | |||
[JsonProperty("icon")] | |||
public string Icon { get; set; } | |||
[JsonProperty("bot_public")] | |||
public bool IsBotPublic { get; set; } | |||
[JsonProperty("bot_require_code_grant")] | |||
public bool BotRequiresCodeGrant { get; set; } | |||
[JsonProperty("team")] | |||
public Team Team { get; set; } | |||
[JsonProperty("flags"), Int53] | |||
public Optional<ulong> Flags { get; set; } | |||
@@ -13,6 +13,8 @@ namespace Discord.API | |||
public string Icon { get; set; } | |||
[JsonProperty("splash")] | |||
public string Splash { get; set; } | |||
[JsonProperty("discovery_splash")] | |||
public string DiscoverySplash { get; set; } | |||
[JsonProperty("owner_id")] | |||
public ulong OwnerId { get; set; } | |||
[JsonProperty("region")] | |||
@@ -22,9 +24,9 @@ namespace Discord.API | |||
[JsonProperty("afk_timeout")] | |||
public int AFKTimeout { get; set; } | |||
[JsonProperty("embed_enabled")] | |||
public bool EmbedEnabled { get; set; } | |||
public Optional<bool> EmbedEnabled { get; set; } | |||
[JsonProperty("embed_channel_id")] | |||
public ulong? EmbedChannelId { get; set; } | |||
public Optional<ulong?> EmbedChannelId { get; set; } | |||
[JsonProperty("verification_level")] | |||
public VerificationLevel VerificationLevel { get; set; } | |||
[JsonProperty("default_message_notifications")] | |||
@@ -43,6 +45,10 @@ namespace Discord.API | |||
public MfaLevel MfaLevel { get; set; } | |||
[JsonProperty("application_id")] | |||
public ulong? ApplicationId { get; set; } | |||
[JsonProperty("widget_enabled")] | |||
public Optional<bool> WidgetEnabled { get; set; } | |||
[JsonProperty("widget_channel_id")] | |||
public Optional<ulong?> WidgetChannelId { get; set; } | |||
[JsonProperty("system_channel_id")] | |||
public ulong? SystemChannelId { get; set; } | |||
[JsonProperty("premium_tier")] | |||
@@ -56,9 +62,23 @@ namespace Discord.API | |||
// this value is inverted, flags set will turn OFF features | |||
[JsonProperty("system_channel_flags")] | |||
public SystemChannelMessageDeny SystemChannelFlags { get; set; } | |||
[JsonProperty("rules_channel_id")] | |||
public ulong? RulesChannelId { get; set; } | |||
[JsonProperty("max_presences")] | |||
public Optional<int?> MaxPresences { get; set; } | |||
[JsonProperty("max_members")] | |||
public Optional<int> MaxMembers { get; set; } | |||
[JsonProperty("premium_subscription_count")] | |||
public int? PremiumSubscriptionCount { get; set; } | |||
[JsonProperty("preferred_locale")] | |||
public string PreferredLocale { get; set; } | |||
[JsonProperty("public_updates_channel_id")] | |||
public ulong? PublicUpdatesChannelId { get; set; } | |||
[JsonProperty("max_video_channel_users")] | |||
public Optional<int> MaxVideoChannelUsers { get; set; } | |||
[JsonProperty("approximate_member_count")] | |||
public Optional<int> ApproximateMemberCount { get; set; } | |||
[JsonProperty("approximate_presence_count")] | |||
public Optional<int> ApproximatePresenceCount { get; set; } | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
#pragma warning disable CS1591 | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API | |||
@@ -8,6 +8,6 @@ namespace Discord.API | |||
[JsonProperty("enabled")] | |||
public bool Enabled { get; set; } | |||
[JsonProperty("channel_id")] | |||
public ulong ChannelId { get; set; } | |||
public ulong? ChannelId { get; set; } | |||
} | |||
} |
@@ -18,6 +18,8 @@ namespace Discord.API | |||
public Optional<bool> Deaf { get; set; } | |||
[JsonProperty("mute")] | |||
public Optional<bool> Mute { get; set; } | |||
[JsonProperty("pending")] | |||
public Optional<bool> Pending { get; set; } | |||
[JsonProperty("premium_since")] | |||
public Optional<DateTimeOffset?> PremiumSince { get; set; } | |||
} | |||
@@ -0,0 +1,13 @@ | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API | |||
{ | |||
internal class GuildWidget | |||
{ | |||
[JsonProperty("enabled")] | |||
public bool Enabled { get; set; } | |||
[JsonProperty("channel_id")] | |||
public ulong? ChannelId { get; set; } | |||
} | |||
} |
@@ -11,9 +11,15 @@ namespace Discord.API | |||
public Optional<InviteGuild> Guild { get; set; } | |||
[JsonProperty("channel")] | |||
public InviteChannel Channel { get; set; } | |||
[JsonProperty("inviter")] | |||
public Optional<User> Inviter { get; set; } | |||
[JsonProperty("approximate_presence_count")] | |||
public Optional<int?> PresenceCount { get; set; } | |||
[JsonProperty("approximate_member_count")] | |||
public Optional<int?> MemberCount { get; set; } | |||
[JsonProperty("target_user")] | |||
public Optional<User> TargetUser { get; set; } | |||
[JsonProperty("target_user_type")] | |||
public Optional<TargetUserType> TargetUserType { get; set; } | |||
} | |||
} |
@@ -6,19 +6,15 @@ namespace Discord.API | |||
{ | |||
internal class InviteMetadata : Invite | |||
{ | |||
[JsonProperty("inviter")] | |||
public User Inviter { get; set; } | |||
[JsonProperty("uses")] | |||
public Optional<int> Uses { get; set; } | |||
public int Uses { get; set; } | |||
[JsonProperty("max_uses")] | |||
public Optional<int> MaxUses { get; set; } | |||
public int MaxUses { get; set; } | |||
[JsonProperty("max_age")] | |||
public Optional<int> MaxAge { get; set; } | |||
public int MaxAge { get; set; } | |||
[JsonProperty("temporary")] | |||
public bool Temporary { get; set; } | |||
[JsonProperty("created_at")] | |||
public Optional<DateTimeOffset> CreatedAt { get; set; } | |||
[JsonProperty("revoked")] | |||
public bool Revoked { get; set; } | |||
public DateTimeOffset CreatedAt { get; set; } | |||
} | |||
} |
@@ -0,0 +1,9 @@ | |||
namespace Discord.API | |||
{ | |||
internal enum MembershipState | |||
{ | |||
None = 0, | |||
Invited = 1, | |||
Accepted = 2, | |||
} | |||
} |
@@ -56,5 +56,7 @@ namespace Discord.API | |||
public Optional<MessageFlags> Flags { get; set; } | |||
[JsonProperty("allowed_mentions")] | |||
public Optional<AllowedMentions> AllowedMentions { get; set; } | |||
[JsonProperty("referenced_message")] | |||
public Optional<Message> ReferencedMessage { get; set; } | |||
} | |||
} |
@@ -1,10 +0,0 @@ | |||
using System; | |||
namespace Discord.API | |||
{ | |||
[Flags] | |||
internal enum MessageFlags : byte // probably safe to constrain this to 8 values, if not, it's internal so who cares | |||
{ | |||
Suppressed = 0x04, | |||
} | |||
} |
@@ -8,7 +8,7 @@ namespace Discord.API | |||
public Optional<ulong> MessageId { get; set; } | |||
[JsonProperty("channel_id")] | |||
public ulong ChannelId { get; set; } | |||
public Optional<ulong> ChannelId { get; set; } // Optional when sending, always present when receiving | |||
[JsonProperty("guild_id")] | |||
public Optional<ulong> GuildId { get; set; } | |||
@@ -1,5 +1,6 @@ | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
namespace Discord.API | |||
@@ -26,5 +27,9 @@ namespace Discord.API | |||
// "client_status": { "desktop": "dnd", "mobile": "dnd" } | |||
[JsonProperty("client_status")] | |||
public Optional<Dictionary<string, string>> ClientStatus { get; set; } | |||
[JsonProperty("activities")] | |||
public List<Game> Activities { get; set; } | |||
[JsonProperty("premium_since")] | |||
public Optional<DateTimeOffset?> PremiumSince { get; set; } | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
#pragma warning disable CS1591 | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API | |||
@@ -21,5 +21,7 @@ namespace Discord.API | |||
public ulong Permissions { get; set; } | |||
[JsonProperty("managed")] | |||
public bool Managed { get; set; } | |||
[JsonProperty("tags")] | |||
public Optional<RoleTags> Tags { get; set; } | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API | |||
{ | |||
internal class RoleTags | |||
{ | |||
[JsonProperty("bot_id")] | |||
public Optional<ulong> BotId { get; set; } | |||
[JsonProperty("integration_id")] | |||
public Optional<ulong> IntegrationId { get; set; } | |||
[JsonProperty("premium_subscriber")] | |||
public Optional<bool?> IsPremiumSubscriber { get; set; } | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using Newtonsoft.Json; | |||
namespace Discord.API.Rest | |||
{ | |||
internal class SessionStartLimit | |||
{ | |||
[JsonProperty("total")] | |||
public int Total { get; set; } | |||
[JsonProperty("remaining")] | |||
public int Remaining { get; set; } | |||
[JsonProperty("reset_after")] | |||
public int ResetAfter { get; set; } | |||
[JsonProperty("max_concurrency")] | |||
public int MaxConcurrency { get; set; } | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API | |||
{ | |||
internal class Team | |||
{ | |||
[JsonProperty("icon")] | |||
public Optional<string> Icon { get; set; } | |||
[JsonProperty("id")] | |||
public ulong Id { get; set; } | |||
[JsonProperty("members")] | |||
public TeamMember[] TeamMembers { get; set; } | |||
[JsonProperty("owner_user_id")] | |||
public ulong OwnerUserId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API | |||
{ | |||
internal class TeamMember | |||
{ | |||
[JsonProperty("membership_state")] | |||
public MembershipState MembershipState { get; set; } | |||
[JsonProperty("permissions")] | |||
public string[] Permissions { get; set; } | |||
[JsonProperty("team_id")] | |||
public ulong TeamId { get; set; } | |||
[JsonProperty("user")] | |||
public User User { get; set; } | |||
} | |||
} |
@@ -29,5 +29,7 @@ namespace Discord.API | |||
public Optional<PremiumType> PremiumType { get; set; } | |||
[JsonProperty("locale")] | |||
public Optional<string> Locale { get; set; } | |||
[JsonProperty("public_flags")] | |||
public Optional<UserProperties> PublicFlags { get; set; } | |||
} | |||
} |
@@ -14,12 +14,16 @@ namespace Discord.API.Rest | |||
public Optional<ulong?> CategoryId { get; set; } | |||
[JsonProperty("position")] | |||
public Optional<int> Position { get; set; } | |||
[JsonProperty("permission_overwrites")] | |||
public Optional<Overwrite[]> Overwrites { get; set; } | |||
//Text channels | |||
[JsonProperty("topic")] | |||
public Optional<string> Topic { get; set; } | |||
[JsonProperty("nsfw")] | |||
public Optional<bool> IsNsfw { get; set; } | |||
[JsonProperty("rate_limit_per_user")] | |||
public Optional<int> SlowModeInterval { get; set; } | |||
//Voice channels | |||
[JsonProperty("bitrate")] | |||
@@ -17,6 +17,8 @@ namespace Discord.API.Rest | |||
public Optional<Embed> Embed { get; set; } | |||
[JsonProperty("allowed_mentions")] | |||
public Optional<AllowedMentions> AllowedMentions { get; set; } | |||
[JsonProperty("message_reference")] | |||
public Optional<MessageReference> MessageReference { get; set; } | |||
public CreateMessageParams(string content) | |||
{ | |||
@@ -1,4 +1,4 @@ | |||
#pragma warning disable CS1591 | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API.Rest | |||
@@ -19,6 +19,8 @@ namespace Discord.API.Rest | |||
public Optional<string> Username { get; set; } | |||
[JsonProperty("avatar_url")] | |||
public Optional<string> AvatarUrl { get; set; } | |||
[JsonProperty("allowed_mentions")] | |||
public Optional<AllowedMentions> AllowedMentions { get; set; } | |||
public CreateWebhookMessageParams(string content) | |||
{ | |||
@@ -1,4 +1,4 @@ | |||
#pragma warning disable CS1591 | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API.Rest | |||
@@ -9,5 +9,7 @@ namespace Discord.API.Rest | |||
public string Url { get; set; } | |||
[JsonProperty("shards")] | |||
public int Shards { get; set; } | |||
[JsonProperty("session_start_limit")] | |||
public SessionStartLimit SessionStartLimit { get; set; } | |||
} | |||
} |
@@ -9,9 +9,13 @@ namespace Discord.API.Rest | |||
[JsonProperty("days")] | |||
public int Days { get; } | |||
public GuildPruneParams(int days) | |||
[JsonProperty("include_roles")] | |||
public ulong[] IncludeRoleIds { get; } | |||
public GuildPruneParams(int days, ulong[] includeRoleIds) | |||
{ | |||
Days = days; | |||
IncludeRoleIds = includeRoleIds; | |||
} | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API.Rest | |||
{ | |||
[JsonObject(MemberSerialization = MemberSerialization.OptIn)] | |||
internal class ModifyGuildWidgetParams | |||
{ | |||
[JsonProperty("enabled")] | |||
public Optional<bool> Enabled { get; set; } | |||
[JsonProperty("channel")] | |||
public Optional<ulong?> ChannelId { get; set; } | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
#pragma warning disable CS1591 | |||
#pragma warning disable CS1591 | |||
using Newtonsoft.Json; | |||
namespace Discord.API.Rest | |||
@@ -10,5 +10,9 @@ namespace Discord.API.Rest | |||
public Optional<string> Content { get; set; } | |||
[JsonProperty("embed")] | |||
public Optional<Embed> Embed { get; set; } | |||
[JsonProperty("flags")] | |||
public Optional<MessageFlags?> Flags { get; set; } | |||
[JsonProperty("allowed_mentions")] | |||
public Optional<AllowedMentions> AllowedMentions { get; set; } | |||
} | |||
} |