Commit Graph

2968 Commits

Author SHA1 Message Date
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
Chris Johnston
65b8c09727 fix: Only escape the closing quotation mark of non-remainder strings (#1226)
Before this change, non-remainder string arguments like @"test \n"
would escape the character 'n', even though there is no reason to.

For the purposes of the command parser, the only character(s) that
can be escaped is the closing quotation mark (typically '"').

This change only removes the backslash character from the resulting
argument if it matches the closing quotation mark. This change
does not affect remainder parameters.

For example:

@"`\\test`" now results in @"`\\test`", not @"`\test`"
@"test \n" results in @"test \n", not "test n"
2019-01-01 21:12:51 -05:00
Chris Johnston
d39bf6ed85 docs: fix the docs index page logo size (#1227)
Fixes the size of the logo on the index page of the documentation.
On mobile or small windows, this logo would be too large.

This adds a rule to the CSS for that logo that fixes it's size.
2019-01-01 20:47:19 -05:00
Christopher Felegy
205499d9ef meta: bump changelog 2018-12-31 13:39:15 -05:00
Christopher Felegy
497918edda fix: raise CommandExecuted on async errors
This resolves #1224.

Previously, raising CommandExecuted for errors was dependent on the
failed result making it back to ExecuteAsync. This is not possible with
async commands, which always pass back a succesful promise result,
rather than their fulfilled result.

This change moves the event invocation for exception'd ExecuteResults to
their source, and excludes ExecuteResult from the late event invocation
in CommandService#ExecuteAsync.
2018-12-31 13:36:30 -05:00
Casino Boyale
552f34c30e docs: Removed double hooking of CommandService log event (#1225)
* Removed double hooking of CommandService log event

The log event is already hooked in Line 38 of program.cs

* Removed redundant log method
2018-12-31 12:18:06 -05:00
Christopher Felegy
cdf60d5c99 meta: bump version to 2.0.1-dev 2018-12-28 21:29:34 -05:00
Christopher Felegy
4a3217fcab meta: v2.0.0
it's finally here
2018-12-28 15:26:38 -05:00
John Mazouri
bafdce4df6 Fix strange borders on main logo in Chrome and Firefox
An img tag gets default styling in these browsers & acts strangely when a src isn't present, and since we switch the logo with css, this can just be a div. Tested & working with all themes in Chrome & Firefox.
2018-12-28 11:54:39 -05:00
Still Hsu
0fecdf69bb docs: Documentation December Update (#1218)
* Fix broken link (#11)

* Fix typos and improve wording

* Add information for IGuildUser

+ Add GetPermission sample
+ Add ModifyAsync remarks

* Add information for IGuildChannel

+ Add ModifyAsync remarks
+ Add GetOverwritePermissionAsync examples

* Add warning for Direction.Around

* Fix indentations and references

* Move IRole.ModifyAsync sample

* Add information for IUser

+ Add example, remarks for Get(Default)AvatarUrl
+ Add example, remarks for GetOrCreateDMChannelAsync
+ Add missing remarks/summary/returns for other properties of the class

* Change verbs used in IVoiceState summary/remarks

* Add additional explanation for IGuildUser.RoleIds

* Change verbs used in IMessage summary/remarks

* Clarify IUserMessage Add/RemoveReactionAsync samples

* Fix command handler sample typo

* Add information for DiscordSocketConfig

+ Add remarks/example to the class
+ Add remarks to AlwaysDownloadUsers

* Fix documentation for SlowMode

* Add additional remarks for Guild/TextChannelProperties

* Update DocFx.Plugins.LastModified to v1.2.0
This should drastically improve docfx build time.

* Add missing dependencies

* Update DocFx.Plugins.LastModified to v1.2.1

Improve performance

* Update DocFx.Plugins.LastModified to v1.2.2

* Clarify deployment.md

+ Rewritten .NET Core deployment strategies for better clarification
    * Split deployment types into framework-dependent and self-contained
    * Clarify the benefits of using different types of publishing
    * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility

* Update post-execution article and samples

+ This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T>

* Update DocFX.Plugin.DescriptionGenerator to v1.1.1

* Adjust according to recent CommandExecuted changes

See:
+ f549da50e0
+ 6260749095

* Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037

* Add partial documentation for the precondition helper class

* Include CHANGELOG.md in docs

* Revise post-execution docs
* Fix incorrect Optional<T> usage
* Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal.

* Streamline docs for Attachment
+ This commit also adds further explanation for why Embeds and Attachments are read-only collections

* Add further documentation for MessageActivity and MessageApplication

* Add caching-related docs to ISocketMessageChannel

* Add missing documentation inheritance for SyncPermissionsAsync

* Streamline documentation process

This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method).

* Cleanup 92bf8363ca

* Update src/Discord.Net.Core/Entities/Channels/Direction.cs

Co-Authored-By: Still34 <341464@gmail.com>

* Update src/Discord.Net.Core/Entities/Channels/Direction.cs

Co-Authored-By: Still34 <341464@gmail.com>

* Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs

Co-Authored-By: Still34 <341464@gmail.com>

* Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs

Co-Authored-By: Still34 <341464@gmail.com>

* Update according to PR suggestions

* Reword sentences of deployment article for clarification & remove mention of portability
* Fix typos/grammar errors within TextChannelProperties

* Add the logo SVG to the page navbar

* Implement changing logo image based on theme color using CSS background image

* Add a favicon

* use the purple logomark instead of white

* hack? set the title to navbar svg to read "Discord.Net Docs"
2018-12-28 08:49:02 -08:00
Christopher Felegy
2a67514e55 meta: bump metapackage to new target frameworks
we now target net46, netstd1.3, and netstd2.0... this bumps from the
previous versions of net45, netstd1.1, netstd1.3
2018-12-28 11:22:51 -05:00
Christopher Felegy
935718fa6e meta: add package logo to distributions
this resolves #1006.
2018-12-28 11:21:10 -05:00
Christopher Felegy
c6adb11a9d meta: remove rendered logo PNGs
this was done with intention to help keep the repository's working size
down, since most of these files will not be used.

rendered images have been moved online to
https://discord.foxbot.me/logo/
2018-12-23 20:03:27 -05:00
Brian Ebeling
5750c3e35b meta: Add Discord.Net logo (#1219) 2018-12-22 22:29:40 -05:00
Christopher Felegy
ac389f5f68 fix: DefaultWebSocket can now correctly close
This resolves a bug where disconnecting the socket client would not
actually close the websocket. Bots would appear to remain online in the
discord client until their connection to discord eventually timed out.

The underlying cause of this issue sourced from the cancellation token
passed into the websocket's ReceiveAsync method - when entering the
disconnect process, the first step is to cancel out all of the
connection tokens. Unfortunately, the standard ClientWebSocket handles a
token cancellation by aborting the socket, rendering it inoperable for a
safe closure.

This change removes the inner cancellation token passed into
ReceiveAsync. The cancellation token is still retained for use in the
receive loop, so the receive task should gracefully complete once some
event satisfies the ClientWebSocket's blocking receive.

To ensure that all clients succesfully close, regardless of their
traffic, the disconnect procedure was rearranged such that awaiting the
receive task now occurs last, after the socket has been closed. Closing
the socket will propagate an event up to the ClientWebSocket's receive
method, which will allow the loop to iterate and gracefully complete.

So far, I have validated this change against basic connection opening
and closing, for both the gateway and voice clients. I have not yet
validated against unplanned connection interruptions, though I believe
that this change might actually improve some of those connection bugs,
since the ClientWebSocket should never find itself in an aborted state.
2018-12-22 12:41:34 -05:00
Christopher Felegy
aec710535f fix: don't manually raise CommandExecuted on exceptions
this resolves #1212.
2018-12-21 14:57:05 -05:00
Christopher Felegy
f2ddf517f7 meta: add pull request template 2018-12-20 17:22:57 -05:00
Christopher Felegy
92bf8363ca feature: Add GuildEmote#CreatorID (#1213)
Co-authored-by: Chris Johnston <chris@thejohnstons.net>

commit 23f5abba4822151a6ba9cb5078752b113c4b8ce6
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Thu Dec 20 17:10:21 2018 -0500

    lint: clean up some long lines

commit 4a8a809db0c2d70c61367c3e1ed4013107cf9f0e
Author: Chris Johnston <chris@thejohnstons.net>
Date:   Sat Dec 15 00:33:05 2018 -0800

    Explain why CreatorId can be null sometimes

commit 9442e4e6358f85177e356f88cd82b73f9f42b1bb
Author: Chris Johnston <chris@thejohnstons.net>
Date:   Fri Dec 14 23:59:01 2018 -0800

    Add the CreatorId property to GuildEmote implementation

commit e0eb94d44cb37c259c27998878330bd68e5706c4
Author: Chris Johnston <chris@thejohnstons.net>
Date:   Fri Dec 14 23:41:54 2018 -0800

    Update the Emoji API model to add User? attribute
2018-12-20 17:10:40 -05:00
Christopher F
65afd37502 feature: add DiscordSocketRestClient (#1198)
* feature: add DiscordSocketRestClient

this resolves #803.

Users can access a DiscordSocketRestClient from the new
`DiscordSocketClient.Rest` property.

DiscordSocketRestClient is a wrapper over DiscordRestClient with certain
state-modifying methods, such as Login/Logout disabled, to prevent users
from breaking the client state.

DiscordSocketRestClient uses the same API client as the
DiscordSocketClient, allowing for shared ratelimiting - meaning users
can now force HTTP requests without needing to wory about running into
429s.

* fix: disallow users from bypassing shadowed login
2018-12-02 13:37:25 -05:00
Christopher Felegy
6d3d906e60 docs: add example of custom error message to sample 2018-12-02 13:36:54 -05:00
Joe4evr
5677f23e9a feature: Allow setting custom error messages for preconditions (#1124)
* Rebase and use in all in-box preconditions

* Silly git....

* Add configurable 'NotAGuild' message

* Respond to feedback
2018-12-02 13:24:32 -05:00
Chris Johnston
f4b1a5f25b fix: Improve validation of Bot Tokens (#1206)
* improve bot token validation by trying to decode user id from token

Try to decode the user id from the supplied bot token as a way of validating the token. If this should fail, indicate that the token is invalid.

* Update the tokenutils tests to pass the new validation checks

* Add test case for CheckBotTokenValidity method

* lint: clean up whitespace

* Add check for null or whitespace string, lint whitespace

* fix userid conversion

* Add hint to user to check that token is not an oauth client secret

* Catch exception that can be thrown by GetString

* Refactor token conversion logic into it's own testable method
2018-12-02 13:03:12 -05:00
Alex Gravely
91e0f03bfd fix: Fix after message remaining in MessageUpdated if message author wasn't in the payload (#1209)
* Fix leaving updated message as null when Discords doesn't include a message author in MESSAGE_UPDATE

* Name! That! Parameter!
2018-12-02 12:57:38 -05:00
Chris Johnston
f6413bac59 fix: Update minimum Bot Token length to 58 char (#1204)
* Update the minimum bot token length to 58 char

- Updates the minimum length of a bot token to be 58 characters. An older 58 char bot token was found by Moiph
- Makes this value an internal const instead of a magic number

* update the TokenUtils tests for 58 char min
2018-11-30 07:10:26 -05:00
Christopher Felegy
6f5693f486 test: bump dependency versions 2018-11-29 17:52:09 -05:00
ComputerMaster1st
ccb16e40c8 fix: Solves UdpClient "ObjectDisposedException" (#1202)
* Solves "ObjectDisposedException"

* Corrected Spelling Error

* Fixed Spelling
2018-11-29 17:20:35 -05:00
ComputerMaster1st
2c93363653 fix: Solves AudioClient Lockup On Disconnect (#1203)
* Solves Audio Disconnect Lockup

* Execute Disconnected Event Before Logger & State
2018-11-29 17:16:46 -05:00
Still Hsu
a3f5e0b3a7 api: [brk] Move Invites-related Methods from IGuildChannel to INestedChannel (#1172)
* Move invites-related methods from IGuildChannel to INestedChannel

* Add missing implementation

...because I somehow forgot it the first time around
2018-11-29 17:15:11 -05:00
ComputerMaster1st
46e2674a93 fix: Added Msg.Content Null Check For Prefixes (#1200)
* Added Msg.Content Null Check

* Minor Change

* Grouped Params In If Statement

* Minor Change
2018-11-29 17:13:50 -05:00
Monica S
7366cd4361 feature: Implement Dispose for types which have disposable data (#1171)
* Initial set of dispose implementations

Not handled yet:
- Discord.Net.Websocket/Entities/SocketGuild
- Discord.Net.Tests

* Refactor DiscordSocketClient init into ctor

This way we remove an IDisposableAnalyzer warning for not disposing
the client when we set the client variable.

* Dispose of clients when disposing sharded client

* Finish implementing IDisposable where appropriate

I opted to use NoWarn in the Tests project as it wasn't really necessary
considering that our tests only run once

* Tweak samples after feedback
2018-11-28 20:18:16 -05:00
jaypaw549
dca6c33da3 fix: Update ChannelCreateAuditLogData.cs (#1195) 2018-11-28 20:17:08 -05:00
Christopher Felegy
5421df14fe feature: add extensions for bulk reactions
this is not api-level bulk reactions (!)
2018-11-27 17:49:30 -05:00
Christopher Felegy
f005af37b4 feature: add Format.Url, Format.EscapeUrl
Format.Url formats a URL into a markdown `[]()` masked URL.

Format.EscapeUrl formats a URL into a Discord `<>` escaped URL.
2018-11-27 17:31:47 -05:00
Nathan Solomon
a64ab6025b Resolve Issue #1188 (Allow Users to specify position when creating a new channel) (#1196)
* Added ability to specify position when creating a channel

* Adjusted categories to include guildproperties and allow specifying position when creating channel categories

* fixed unimplemented methods (for CreateCategoryChannelAsync) and added appropriate documentation
2018-11-27 17:16:32 -05:00
Casino Boyale
10233f3a9a fix: Fixed CommandExecuted firing twice for failed RuntimeResults (#1192)
* Fixed CommandExecuted firing twice for failed RuntimeResults

* Changed to just checking the result type

* Amendments
2018-11-20 14:16:27 -05:00
Casino Boyale
f9c95bc461 Got rid of use of undefined variables 2018-11-08 16:11:50 +00:00
Joe4evr
419c0a5b53 feature: Add a way to invoke a command specifying optional values by name (#1123)
* Add NamedArgumentTypeAttribute

* Add NamedArgumentTypeReader

* Fix superflous empty line.

* Fix logic for quoted arguments

* Throw an exception with a tailored message.

* Add a catch to wrap parsing/input errors

* Trim potential excess whitespace

* Fix an off-by-one

* Support to read an IEnumerable property

* Add a doc

* Add assertion for the collection test
2018-11-06 18:36:44 -05:00
Alex Gravely
8ef5f8120f feature: add Add Guild Member endpoint (#1183)
* Add AddGuildMember Oauth endpoint support

* Concat RoleIds if already exists.

* Use local ids variable.
2018-11-05 18:34:09 -05:00
Still Hsu
7dd2268982 lint: Discord Namespace Clean-up (#1185)
* Remove RpcException

* Move RestConnection to Discord.Net.Rest

* Remove RpcVirtualMessageChannel

* Move REST objects to Discord.Net.Rest

* Fix Discord.Rest namespace
2018-11-05 18:32:30 -05:00
OatmealDome
c1d5152212 fix: UploadWebhookFileParams: Move most things into a json_payload (#1186) 2018-11-04 17:43:36 -05:00
Chris Johnston
8e6e0e9ad2 lint: Remove public setters for MessageApplication, MessageActivity properties (#1182)
This fixes an error that was introduced in d30d12246d (thanks Still for noticing!)

Changes the public property setters of the MessageActivity and MessageApplication entities to be
internal, since they cannot be modified by the user in the API.
2018-10-21 17:27:02 -04:00
Still Hsu
8fa70bf6a6 lint: Initial clean-up (#1181) 2018-10-21 17:26:39 -04:00
Christopher F
5b3eb70ffd meta: add changelog 2018-10-20 15:00:08 -04:00
Alex Gravely
637d9fc794 Add SocketUser.MutualGuilds + various command ext. methods. (#1037)
* Add SocketUser.MutualGuilds + various ext. methods.

* Search through submodules for GetExecutableCommandAsync

* Allow GetExecutableCommandsAsync(ModuleInfo) to recurse properly to all submodules.

* Bump down lang. version & whitespace cleanup.

* Change to use Task.WhenAll

* Change to ICollection<CommandInfo>

* Resolve build errors.
2018-10-20 14:40:13 -04:00
Still Hsu
649a779c23 feature: Add invite maxAge check before attempting to create the invite (#1140)
* Add maxage check & improve maxage parameter check

* Change InvalidOperation to ArgumentOoR

* Remove HasValue check
...since it does it implicitly already.

* Add parameter names & better wording for invite OoR

* Move maxAge check to DiscordRestApiClient for consistency
2018-10-20 12:45:05 -04:00
Christopher F
f549da50e0 fix: pass the entire Exception into ExecuteResult 2018-10-20 11:01:17 -04:00
Christopher F
6260749095 fix: invoke CommandExecuted on async exception failures 2018-10-20 10:52:26 -04:00
Christopher F
a253b7ee75 docs: remove duplicated MessageReceived hook 2018-10-20 10:07:10 -04:00