fix for: https://github.com/discord-net/Discord.Net/issues/1436
`SlowModeInterval` property causes an exception for Announcement Channel feature if it is enabled on discord. Should be checked whether it is specified or not before set to property.
* Add Direction.Around to GetMessagesAsync
* Reuse the method
* Reuse GetMany
* Fix limit when getting from cache without message id
* Fix limit when getting from rest without message id
* Change cache return
It will return in a similar way to REST
The GuildHelper.CreateRoleAsync() was sending 2 requests to create a role. One to create the role, and one to modify the role that was created. This can be done in one request. So i have moved it to a single request to lower the amount of requests send to the api. This will also solve issue #1451.
* Feature: Allowed mentions object on msg create (interface breaking)
This change implements the AllowedMentions object for the payload of message creation. By default, the mentions behavior remains unchanged, the message content is parsed for all mentionable entities and they are all notified. If this payload is not null, it will use the content of the allowed_mentions field to determine if a role is notified, or just displayed.
This change is interface breaking. This follows the conventions of keeping RequestOptions as the last argument, but could break some users who specify each of these arguments without using named arguments.
* lint: remove commented-out code
This change removes the commented-out code which was added during testing from the previous commit.
* fix interface break: reorder allowedMentions arg so that it's after options
This change modifies the order of the AllowedMentions argument of SendMessageAsync so that this addition shouldn't be interface breaking. The downside to this change is that it breaks the convention followed by other methods, where the RequestOptions argument is normally last.
* docs: fix typo in allowedMentions arg doc
* fix interface break arg from IRestMessageChannel
* docs: update xmldoc for allowedMentions args
* fix interface breaking arg order for ISocketMessageChannel
* fix mocked classes that weren't updated
* fix: RestDMChannel#SendMessageAsync bug, allowed mentions always null
This change fixes a bug that was introduced while testing changes to the interface of the SendMessageAsync method to try and retain interface compatibility
* docs: update xmldoc for AllowedMentions type
* docs: reword xmldoc of AllowedMentionTypes type
* docs: fix typo
* fix: validate that User/Role flags and UserIds/RoleIds lists are mutually exclusive
This change adds validation to SendMessageAsync which checks that the User flag is mutually exclusive with the list of UserIds, and that the Role flag is also mutually exclusive with the list of RoleIds
* docs: reword summaries for AllowedMentions type
* Add util properties for specifying all or no mentions
Adds read only properties which specify that all mentions or no mentions will notify users. These settings might be more common than others, so this would make them easier to use.
* docs: Resolve PR comments for documentation issues/typos
* Add doc page for Named Arguments
* Implement minor stylistic changes
* Update docfx.json to support NS2.0
Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com>
* Fix broken xref in basic-operations
* Fix broken crefs
* Fix wordings in named argument
* Fix misleading warning about long-running code
* Fix misleading CommandService summary
Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com>
* Update copyright year and version
Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com>
* Escape example captions
* Add warning regarding FlattenAsync for GetReactionUsersAsync
* Fix a minor grammar mistake
Co-authored-by: Joe4evr <jii.geugten@gmail.com>
This change updates the NewsChannel classes so that the overwrite permission-related properties no longer throw an Exception when they are used.
These properties were not initially supported by News/Announcement channels when the feature was first released, but now they are.
* Fix#1335 Add isMentionable parameter to CreateRoleAsync in non-breaking manner
This PR adds the isMentionable parameter to the CreateRoleAsync method
in a way that prevents it from being interface-breaking. This has been done
by adding it as an optional parameter at the end of publicly-exposed
methods.
This parameter determines if the newly created role can be mentioned as it is
created.
* Overload CreateRoleAsync methods
* Added support for Message References
* Removed unused usings, added debugger display, updated ToString override
* Changed snowflakes to be wrapped in an optional instead of a nullable.
* Fix#1381 Guild PreferredLocale support
Adds support for getting and modifying a guild's preferred_locale. This is a language tag in IETF BCP 47 format, which works with the built-in CultureInfo.
While Discord only supports a number of cultures, I think that this restriction should be handled at the API and not by the wrapper. (Also easier on our end)
* Add PreferredCulture to IGuild
This property was defined in RestGuild and SocketGuild, so it only makes sense to make it part of IGuild as well.
* docs: adjust wording of ActivityType.Watching enum
Adjusts the xmldoc summary wording of the ActivityType.Watching enum to
fix a wording issue.
* Add D.NET Logo to Open Graph meta tags
* Update DescriptionGenerator
...And update color to suit the logo better
* Disable smooth scrolling due to user complaints
* Remove unnecessary spacing in sideaffix
* Update footer version
* Remove featherlight plugin
As it is unnecessary and can break image tags
* Adjust wordings regarding safe-handling of secrets
* Fix formatting for first bot token sample
* Add badges to homepage
* Minor wording fixes on terminal
* Update to higher quality PNG
* Add Discord.Net.Example in sln for build validation
* Clarify all instances of IAsnycEnumerable
* Clarify overridden props in SocketNewsChannel
* Add returns and params docs for SyncPermissionsAsync
* Remove/fix invalid XMLdoc strings
* Remove AppVeyor and add GitHub badge
* Support filtering audit log entries on user, type, and before id
Adds support for filtering audit log entires with GetAuditLogsAsync. Adds the ability to specify a userId and ActionType to filter. Exposes the beforeId filter which was already implemented, yet unused (even when requesting > 100 entries)?
Was thinking that this could expose overloads of GetAuditLogAsync that accepts a IUser and IAuditLogEntry, but dealing with all the combinations of these types may be excessive.
* use only stringbuilder for args instead of string interpolation
* Fix bugs
* Add missing properties
* Add missing properties to ChannelInfo
Remove UserLimit property
* Add missing properties to GuildInfo
Change ContentFilterLevel of type int? to ExplicitContentFilter of type ExplicitContentFilterLevel?
* Remove AvatarHash from MemberInfo
* Add missing doc comments
* Make ExplicitContentFilter public
* Add ChannelId property to overwrite audits
* Update doc comments based on feedback
* Parse double for X-Reset-After instead of float, needs more precision
Float did not contain enough precision to store the millisecond unix
time value, which resulted in the second and millisecond values being
slightly off.
This can be easily tested using:
```cs
> DateTimeOffset.FromUnixTimeMilliseconds((long)(1470173022.123f *
1000)).Millisecond
160 // wrong
> DateTimeOffset.FromUnixTimeMilliseconds((long)(1470173022.123 *
1000)).Millisecond
123 // correct
```
* Parse RateLimit-Reset using an IFormatProvider
* State NumberStyle and use CultureInfo.InvariantCulture for any parsing
This updates most occurances in the code where a Parse or TryParse method was used to explicitly state the NumberStyle, and to use CultureInfo.InvariantCulture.
CultureInfo was used over NumberInfo, as it also works on DateTime parsing too.
* Use default format spec in Commands
* Move reaction methods of IUserMessage to IReactionMessage
Moves the reaction-related methods contained in IUserMessage to the IReactionMessage type. Updates the type of ISystemMessage so that it implements IReactionMessage.
* Move rest reaction implementation to RestReactionMessage
Copies the reaction implementation from RestUserMessage to RestReactionMessage. Updates RestUserMessage and RestSystemMessage to be derived from RestReactionMessage instead of RestMessage.
* Move WS reaction implementation to SocketReactionMessage
Copies the reaction implementation from SocketUserMessage into SocketReactionMessage. Updates SocketSystemMessage and SocketUserMessage to use SocketReactionMessage as the base class.
* docs: update summary for ReactionMessage classes
* Remove ReactionMessage types, move reaction impl to IMessage
Removes the IReactionMessage and derived types, which was unnecessary since all classes derived from IReactionMessage were IMessage.
Moves the reaction implementation to IMessage and derived types.
While it might be more proper to refer to a voice state as composing
a stream (i.e., the IVoiceState is a Stream), this property is ported
up most often to actual user entities. It makes more sense to
communicate that the user is streaming, rather than stating that the
user itself is a stream.
This is also more gramatically consistent with the other voice state
properties (e.g., IsMuted). Movement from noun-form to participle-form
remains inline with the past-participle form used on the other
properties.
* Add self_stream voice state property
Adds the self_stream property which is set true when a user is streaming a video to a voice channel
* use flags for selfstream state instead of its own prop
* implement a fix for tags being found in code blocks
still needs polish, consider this a rough draft
* refactor to reuse a local function
uses CheckWrappedInCode to check that there are no code blocks that surround the tag being parsed
* Add more test coverage of MessageHelper.ParseTags
* reset indexes for @ here mention
* add a test case to catch error fixed from prev commit
* wip commit of most test cases working
* fix the Enclosed in block util method
* code cleanup
* lint whitespace
* lint brackets for single line if blocks
* move messagehelpertests to the new unit test dir
* expose internals to the unit test project
this seems to have been breaking the build, since CI would build the merged branch, where rest wasn't exposed to the unit tests
* Implement Client Status Support
Adds support for using the client_status as sent as part of the Presence model. This value can be used to determine if a user is active on the native desktop app, the mobile app, or the website.
* lint: whitespace in IPresence
* Remove breaking change to IPresence interface with a note for 2.1
* update comment to not reference 2.1
* re-add interface break to IPresence
* add example payload for client_status
* use inline declaration for Enum.TryParse
* add new MessageTypes
* Add new properties to the updated models
* add the SystemChannelMessageDeny
unsure if there would be a better name for this enum, given it's inverted nature, open for suggestions
* add PremiumTier flag, add Guild description property
* add method for getting vanity image from CDN
* make the size of GetGuildVanityUrl optional
* lint: remove commented out code from prev commit
* add a None flag to SystemChannelMessage enum
* implement the new modify guild params
* implement additional model properties in IGuild types
* implement GuildMember PremiumSince
* docs: reword size param explanation
* add extension methods that make it easier to check the SystemChannelMessage flags for end users
because the flag is inverted, this ideally should make it easier for the user. it may also be useful to do something similar for modifying this property
* docs: correct typo from copy-paste
* add the premium_subscription_count property
* fix vanity url code and banner switchup
a mistake was made somewhere, that's all I know for sure
* clarify remark on inverted logic for system channel flags
* fix PremiumSubscriptionCount optional value
* add another example to the systemchannelflags xmldoc remark
* docs: fix typos, clarify wording
* use DateTimeOffset for PremiumSince, follow conventions from other prop
* WIP commit, update IActivity and IUser with missing types
* incomplete implementation of interfaces
* Add implementation of activity flags, and extension method to check flag
* remove usings that were not required
* clean up files and add documentation where missing
* remove unused usings
* Add remark saying that premium_type info may be inaccessible to bots
it seems that this information can not be accessed by any user,
and may require the identity oauth scope
* Add locale property to the user model
adds the locale property to the user model, which appears not to be
specified for bots
* rename ActivityFlags
* Add incomplete xmldoc to ActivityFlag
Added xmldoc to the ActivityFlag type, excluded flags that i was unsure about
* rename the UserFlags file
* Add incomplete xmldoc to UserFlag enum
* Remove unnecessary extension methods and use built-in functionality
* use <c> tag for xmldoc 'null's
* Add xmldoc for JoinRequest ActivityFlag
* improve the PremiumType xmldoc
* Add zero activityflag
* Add summary tag verbs, example of IUser locale
* Rename Flag enum types to use Properties suffix
* Expose the details field in the Game model
* update Activity extension methods to support Details field
* Use inherited Details implementation in RichGame
* lint: remove commented out code from debugging
* Fix issue in previous commit
* Move oauth-only user fields to SelfUser classes
Moves the implementation of the Flags, PremiumType, and Locale user fields to ISelfUser classes. In testing, it seemed that normal bot accounts did not have this information supplied to them. When tested with a Bearer token in the Rest client, these fields are set.
* remove old HypeSquadEvents flag that appears to have been replaced with the new HypeSquad flags
* Feature: Disconnect users from voice channels
Updates GuildUserProperties to allow for setting either Channel or ChannelId to null, which will disconnect users from voice channels.
The type of ChannelId has been updated from a ulong to ulong?, which matches the latest api documentation.
* docs: update xmldoc wording
* breaking workaround, revert ChannelId to ulong
This is a workaround to prevent this PR from being a breaking
change. Reverts the type of GuildUserProperties#ChannelId to a
ulong from a ulong?. Guild Users may no longer be kicked by
setting this property to null, but setting
GuildUserProperties#Channel should still work.
* Set the @everyone IRole for @everyone and @here tags
Adds support for setting the IRole corresponding to @everyone or @here in a the tags of a message. Previously this would only set the TagType, but leave the value as null.
This does not distinguish between @everyone and @here, as that's done using TagType. The values of both will be the same.
This issue was suggested by @TheCasino
* use the EveryoneRole property
oops
* use null conditional operator instead of a null check
Resolves#1216.
* Add support for spoiler formatting
* Implement support for sending message attachments that are spoilers
* use consistent naming
* update docstring for new isSpoiler param
* move extension method to be under core project, make spoiler prefix a const
* typo fix
* update missing xmldocs
* move SpoilerPrefix const outside of interface
* Add isSpoiler support to webhook client
adds the isSpoiler field to uploading files with a webhook, which will only
insert "SPOILER_" to the start of the filename. This does not include other
fields in the payload, as this is not in the documentation, and was not observed
like in the regular client
* Remove template in favor of official samples
* Fixed a variable name copy pasta mistake
line 35 was _database.GetData() instead of DBService.GetData()
* Experimental theme change
* Change paragraph, code, heading fonts
* Widen viewport
* Update DocFX.Plugins.LastModified v1.2.3
* Exclude Discord.API in docs
* Add remarks for SocketReaction properties
* Add examples for BaseSocketClient.Events
* Add additional clarification for some methods
* Move IUser and IGuildChannel examples
* Clarify several guides samples with notes
- Reword TypeReader comment to avoid giving the idea that the sample itself is "obsolete"
- Remove CommandException logging comment regarding C#7.0 as the version is now the standard across VS2017 and up
- Remove suggestion about handling result in command handler since it is now advised to use CommandExecuted instead
+ Add additional comment to clarify ctor for DI setup
* Add/migrate code examples
* Incorporate material design theme
License @ https://github.com/ovasquez
* Update installation and nightly guide
* Fix improper indentations made obvious by the widen viewport
* Fix minor grammar issues
+ Add installation for nightly build using dotnet CLI
* Fix nav level indentation
* Revise "Your First Bot" article
* Merge some paragraphs to avoid clutter while keeping readability
* Reword the use of command framework
+ Add additional warning/note about environment variable
* Add additional indent level
* Fix indentation text warping
* Remove connections sample
* Update logging sample
Remove redundant part of the sample
* Remove mention of RPC
* Remove misleading section about commands
- Remove command sample from complete snippet
* Revise "Your First Bot" command paragraphs
* Change wording to hint devs that additional command parser packages may be available, as more and more begin to crop up
* Update themes
* Add XML docs contribution guidelines
Update guidelines
* Update CommandExecuted remarks
* Fix precondition remarks typo
no one saw that ok
* Fix permission sample in docfx
* Fix IMessageChannel samples
* Update docs/_template/light-dark-theme/styles/docfx.vendor.minify.css
Co-Authored-By: Still34 <341464@gmail.com>
* Update docs/_template/light-dark-theme/styles/material.css
Co-Authored-By: Still34 <341464@gmail.com>
* Update docs/_template/light-dark-theme/styles/material.css
Co-Authored-By: Still34 <341464@gmail.com>
* Fix#1270 Add the AuthorId to MessageDeleteAuditLogData
Fix#1270
Adds the AuthorId property to MessageDeleteAuditLogData, which is set
by the TargetId in the audit log entry data.
This property is the user id that created those messages in the first place.
I am not aware of an instance of when this value would not be supplied.
* Adjust xmldoc wording
* add News channel type
* remove (very outdated) todo
* add [Socket/Rest]NewsChannel types
* update TextChannel properties to include a Type optional parameter with validation
as of writing, this feature is still only available to verified guilds, which makes it impossible for testing.
* actually create the news channels when given the type
* throw NotSupportedException in News channel
throw a NotSupportedException whenever trying to use SlowModeInterval or anything related to overwrite permissions
* make RestNewsChannel throw NotSupportedException also
* remove the (untested) ability to change channel types