Commit Graph

3015 Commits

Author SHA1 Message Date
Christopher Felegy
a44c13af78 fix: call OnLogin/OnLogout on DiscordSocketRestClient
Resolves #1277.
2019-05-18 09:32:49 -04:00
Chris Johnston
f3b20b2b6d feature: Add support for spoiler formatting & attachments (#1255)
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
2019-05-17 19:28:40 -04:00
Christopher Felegy
76f82d687b perf: only allocate cacheableList once 2019-05-17 19:20:55 -04:00
Christopher Felegy
358b9e7b7b lint: fix docstring inconsistency 2019-05-17 19:09:07 -04:00
Christopher Felegy
03e6401d19 lint: clean up bulk delete PR 2019-05-17 19:08:20 -04:00
NovusTheory
dec353e57f feature: messages bulk deleted event (from previous PR #1120) (#1236)
* Reimplement messags bulk deleted event RogueException/Discord.Net#1120

* Update remark

* Backwards compatability with config option
2019-05-17 18:49:36 -04:00
GreemDev
b52b54d80c fix: EmbedBuilderExtensions no longer has an extension for WithAuthor(IGuildUser). (#1294)
The embed should not display nickname#discriminator as that's incorrect.
So the extension was scrapped altogether to use the IUser (and by inheritance, IGuildUser) one.
2019-05-13 18:30:38 -04:00
Still Hsu
4309550ca0 docs: Main docs update (#1304)
* 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>
2019-05-13 18:29:47 -04:00
Chris Johnston
5ea3e113b8 docs: add missing xmldoc for inherited properties and NotAGuildErrorMessage (#1301)
- adds inheritdoc tag to the inherited ErrorMessage properties of several attributes

- adds xmldoc summary for the NotAGuildErrorMessage properties
2019-05-13 18:28:13 -04:00
Chris Johnston
bb61efabf3 feature: Check for whitespace or newline characters in tokens (#1305)
* Trim whitespace from tokens before logging in

This change trims whitespace characters from the supplied token before it is used to log in. Users can encounter this accidentally if they read their token from a file that ends with a blank line.

Leading whitespace will make the token invalid. Trailing whitespace or \n (not \r\n) will also fail to log in. \r\n (CRLF) doesn't fail because of the line break style for http request headers.

* revert trimming api token

* add check for whitespace or newline characters to existing token validation

Checks to see if a token contains any illegal characters, like whitespace or a newline. If it is, throws an ArgumentException warning the user that their token may be invalid.

I considered only checking the first and last character, but given that a token containing whitespace or a newline wouldn't work either I figured this made sense.

* removed unused usings

These were leftover from a previous approach using an ImmutableHashSet
2019-05-13 18:27:45 -04:00
Still Hsu
0275f7df50 docs: Update copyright year and docs version (#1243) 2019-05-04 17:18:25 -04:00
Chris Johnston
f2113c7c2b feature: Add webhook url overload for DiscordWebhookClient (#1260)
* Add webhook url overload for DiscordWebhookClient

Adds an overloaded constructor for `DiscordWebhookClient` which accepts the webhook URL. This URL is parsed using a regex for the id and token. If the token is invalid an `ArgumentException` is thrown.

* add null or whitespace check

* add some tests for the new DiscordWebhookClient constructor

* make the Regex static, specify flags

* update regex to look for "discordapp"

* specify reason why exception is thrown despite regex match

* move parsing logic into new function for testing
2019-05-04 17:14:32 -04:00
Chris Johnston
1ae42207f8 feature: Fix #1270 Add the AuthorId to MessageDeleteAuditLogData (#1271)
* 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
2019-05-04 17:08:46 -04:00
Still Hsu
00d3f5a8e5 feature: Add GuildMemberJoin MessageType(#1263) 2019-05-04 17:08:18 -04:00
Still Hsu
e03c5274f8 feature: Add GetCategory method (#1261) 2019-05-04 17:07:56 -04:00
Chris Johnston
9084c4214e feature: Fix #1280 Add NewsChannel Types (#1293)
* 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
2019-05-04 17:07:31 -04:00
Christopher Felegy
2254a99942 meta: bump version to 2.1.0-dev 2019-05-04 17:05:26 -04:00
Casino Boyale
51618e66f2 docs: Fixed mistake in EmbedBuilder docs page (#1303) 2019-05-04 17:00:26 -04:00
Christopher Felegy
5569873717 fix: PacakgeReference belongs under an ItemGroup 2019-03-26 16:57:44 -04:00
Christopher Felegy
8003ac80e4 dep: flag IDisposableAnalyzers as private, bump version 2019-03-26 16:56:24 -04:00
Joe4evr
b2ebc03da7 fix: Initialize ImmutableArray fields (#1292) 2019-03-26 16:51:15 -04:00
Christopher Felegy
dffbc656fd meta: new readme badge 2019-03-17 13:12:23 -04:00
Christopher Felegy
6216fe3a56 ci: remove appveyor config
bon voyage
2019-03-17 13:06:16 -04:00
Christopher Felegy
2fa8df8624 ci: switch to release feed/branch 2019-03-17 13:06:16 -04:00
Christopher Felegy
f9a0d50d56 ci: the agent does not come with nuget installed 2019-03-17 13:06:16 -04:00
Christopher Felegy
4d3dcc957c ci: publish metapackage 2019-03-17 13:06:16 -04:00
Christopher Felegy
0a8f51c560 ci: use correct publish feed key 2019-03-17 13:06:16 -04:00
Christopher Felegy
35b6326889 ci: use proper nuget deploy 2019-03-17 13:06:16 -04:00
Christopher Felegy
e2ed8f1114 ci: fix deploy uri 2019-03-17 13:06:16 -04:00
Christopher Felegy
af3d61b906 test: just get rid of channel perm tests 2019-03-17 13:06:16 -04:00
Christopher Felegy
1d0de061e2 test: another one 2019-03-17 13:06:15 -04:00
Christopher Felegy
bc5d608712 test: forgot an #endif? 2019-03-17 13:06:15 -04:00
Christopher Felegy
b2295a6450 test: disable broken tests 2019-03-17 13:06:15 -04:00
Christopher Felegy
3d1cc3db7e ci: don't build Windows_build when deploy condition met 2019-03-17 13:06:15 -04:00
Christopher Felegy
0bb9097534 ci: can't have spaces either 2019-03-17 13:06:15 -04:00
Christopher Felegy
fa680209e0 ci: job cannot have a paranthesis 2019-03-17 13:06:14 -04:00
Christopher Felegy
e7d52fded1 ci: rewrite to use scripts 2019-03-17 13:06:14 -04:00
Christopher Felegy
0de7f94447 ci: variables is an index, not a fn 2019-03-17 13:06:14 -04:00
Christopher Felegy
e1bc3a3f0c ci: move condition back to root, debug deploy 2019-03-17 13:06:14 -04:00
Christopher Felegy
5d3bf981de ci: move deploy condition to deploy.yml 2019-03-17 13:06:14 -04:00
Christopher Felegy
369fb78e2f ci: remove comment? 2019-03-17 13:06:14 -04:00
Christopher Felegy
9b2bc18c5c ci: add azure pipelines 2019-03-17 13:06:13 -04:00
Paulo
049b014518 fix: Fix NRE when getting audit logs (#1256)
* Fix NullReferenceException when the webhook was deleted

* Fixing doc note

* Better documentation regarding the webhook object

Co-Authored-By: SubZero0 <pnmanjos@hotmail.com>
2019-03-16 15:05:00 -04:00
Still Hsu
2473619e63 docs: Clarify command samples (#1257)
* Clarify command samples by adding additional notes about each methods

* Add additional notes for the Program class

* Change wording on token read

* Change prefix sample to match referenced example

Co-Authored-By: Still34 <341464@gmail.com>
2019-03-16 14:49:53 -04:00
Paulo
377622b2a8 fix: Fix NullReferenceException at MESSAGE_CREATE (#1268)
After talking at the Discord.Net channel, @Quahu stated the `member` prop doesn't contain the `user` in this payload (and it's described as being a partial at https://discordapp.com/developers/docs/resources/channel#message-object).

I completed it using the `author` prop, that I believe it's the cleanest way of dealing with it (without changing the GuildMember class or the AddOrUpdateUser method).

Solves #1267
2019-03-16 14:44:36 -04:00
Chris Johnston
b80f0e84e7 docs: Use a relative path for docs index page logo (#1276)
* Use a relative path for docs index page logo

Changes the paths for the logo on the index page of the documentation
to use relative links instead of absolute ones.

The current absolute path is just fine as long as the site
is not hosted under another directory. When opening files locally
(without serving them in docfx) these images will fail to load.
In addition, if these files are served under a directory that is
not the root endpoint (like: `docs.com/stable/`) the images will
also break.

I tested these changes locally using these steps:

- Build & serve docs: `docfx docs/docfx.json --serve`
- Verify that logo shows up on index page using all 3 themes
- Open `docs/_site/index.html`
- Verify logo works on all 3 themes

* Minor grammar fix in DiscordSocketClient
2019-03-16 14:35:45 -04:00
Chris Johnston
48b327be3e fix: fix false invalidation when decoding token User Ids (#1278)
* add a util method for padding base64 strings if they are not of an expected length

* return the original string if it already contains padding, do not throw

* add tests for padding method, and for token that needs padding
2019-03-16 14:34:50 -04:00
Christopher Felegy
db50badcc4 meta: bump version to 2.0.2-dev 2019-01-09 16:11:31 -05:00
Christopher Felegy
a8c99f75bc meta: v2.0.1
happy patch friday
2019-01-04 12:04:52 -05:00
Joe4evr
feed4fd752 docs: Replace obsolete Precondition sample with something new (#1230)
* Replace obsolete Precondition sample with something new

* Feedback

Whoops. 👌

Co-Authored-By: Joe4evr <jii.geugten@gmail.com>
2019-01-04 11:56:57 -05:00