Browse Source

Add titles and UIDs to each article

pull/988/head
Hsu Still 7 years ago
parent
commit
ecda318ae8
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
31 changed files with 140 additions and 78 deletions
  1. +1
    -1
      docs/_overwrites/Commands/DontInjectAttribute.Overwrite.md
  2. +11
    -8
      docs/api/index.md
  3. +8
    -3
      docs/faq/basics/basic-operations.md
  4. +6
    -1
      docs/faq/basics/client-basics.md
  5. +5
    -0
      docs/faq/basics/getting-started.md
  6. +0
    -0
      docs/faq/basics/images/dev-mode.png
  7. +0
    -0
      docs/faq/basics/images/snowflake.png
  8. +0
    -0
      docs/faq/basics/samples/cast.cs
  9. +0
    -0
      docs/faq/basics/samples/emoji.cs
  10. +10
    -5
      docs/faq/commands/Commands.md
  11. +0
    -0
      docs/faq/commands/samples/DI.cs
  12. +0
    -0
      docs/faq/commands/samples/Remainder.cs
  13. +0
    -0
      docs/faq/commands/samples/runmode-cmdattrib.cs
  14. +0
    -0
      docs/faq/commands/samples/runmode-cmdconfig.cs
  15. +5
    -0
      docs/faq/misc/Glossary.md
  16. +5
    -0
      docs/faq/misc/Legacy.md
  17. +6
    -6
      docs/faq/toc.yml
  18. +5
    -0
      docs/guides/commands/commands.md
  19. +7
    -2
      docs/guides/commands/post-execution.md
  20. +14
    -14
      docs/guides/concepts/connections.md
  21. +5
    -4
      docs/guides/concepts/entities.md
  22. +7
    -6
      docs/guides/concepts/events.md
  23. +5
    -4
      docs/guides/concepts/logging.md
  24. +9
    -8
      docs/guides/getting_started/first-bot.md
  25. +1
    -0
      docs/guides/getting_started/installing.md
  26. +1
    -1
      docs/guides/getting_started/terminology.md
  27. +5
    -0
      docs/guides/introduction/intro.md
  28. +11
    -11
      docs/guides/toc.yml
  29. +1
    -0
      docs/guides/voice/sending-voice.md
  30. +9
    -3
      docs/index.md
  31. +3
    -1
      docs/toc.yml

+ 1
- 1
docs/_overwrites/Commands/DontInjectAttribute.Overwrite.md View File

@@ -6,7 +6,7 @@ remarks: *content
The attribute can be applied to a public settable property inside a
@Discord.Commands.ModuleBase based class. By applying this attribute,
the marked property will not be automatically injected of the
dependency. See [Dependency Injection](../../guides/commands/commands.md#dependency-injection)
dependency. See [Dependency Injection](xref:Guides.Commands.Intro#dependency-injection)
to learn more.

---


+ 11
- 8
docs/api/index.md View File

@@ -1,13 +1,16 @@
---
uid: API.Docs
---

# API Documentation

This is where you will find documentation for all members and objects in Discord.Net
This is where you will find documentation for all members and objects in Discord.Net.

__Commonly Used Entities__
# Commonly Used Entities

* @Discord.WebSocket
* @Discord.WebSocket.DiscordSocketClient
* @Discord.WebSocket.SocketGuildChannel
* @Discord.WebSocket.SocketGuildUser
* @Discord.WebSocket.SocketMessage
* @Discord.WebSocket.SocketRole
* @Discord.WebSocket
* @Discord.WebSocket.DiscordSocketClient
* @Discord.WebSocket.SocketGuildChannel
* @Discord.WebSocket.SocketGuildUser
* @Discord.WebSocket.SocketMessage
* @Discord.WebSocket.SocketRole

docs/faq/basic-operations.md → docs/faq/basics/basic-operations.md View File

@@ -1,3 +1,8 @@
---
uid: FAQ.Basics.BasicOp
title: Questions about Basic Operations
---

# Basic Operations Questions

## How should I safely check a type?
@@ -15,7 +20,7 @@ action.

A good and safe casting example:

[!code-csharp[Casting](samples/basics/cast.cs)]
[!code-csharp[Casting](samples/cast.cs)]

[InvalidCastException]: https://docs.microsoft.com/en-us/dotnet/api/system.invalidcastexception
[this post]: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/how-to-safely-cast-by-using-as-and-is-operators
@@ -44,7 +49,7 @@ able to message.
You may check the message channel type. Visit [Glossary] to see the
various types of channels.

[Glossary]: Glossary.md#message-channels
[Glossary]: xref:FAQ.Misc.Glossary#message-channels

## How can I get the guild from a message?

@@ -69,7 +74,7 @@ In Discord.Net, an Emote represents a server custom emote, while an
Emoji is a Unicode emoji (standard emoji). Both [Emoji] and [Emote]
implement [IEmote] and are valid options.

[!code-csharp[Emoji](samples/basics/emoji.cs)]
[!code-csharp[Emoji](samples/emoji.cs)]

[AddReactionAsync]: xref:Discord.IUserMessage.AddReactionAsync*


docs/faq/client-basics.md → docs/faq/basics/client-basics.md View File

@@ -1,3 +1,8 @@
---
uid: FAQ.Basics.ClientBasics
title: Basic Questions about Client
---

# Client Basics Questions

## My client keeps returning 401 upon logging in!
@@ -42,7 +47,7 @@ event is triggered, then you can proceed to do whatever you like.
If you need to do anything with messages (e.g. checking Reactions,
checking the content of edited/deleted messages), you must set the
[MessageCacheSize] in your [DiscordSocketConfig] settings in order to
use the cached message entity. Read more about it [here](../guides/concepts/events.md#cacheable).
use the cached message entity. Read more about it [here](xref:Guides.Concepts.Events#cacheable).

1. Message Cache must be enabled.
2. Hook the MessageUpdated event. This event provides a *before* and

docs/faq/getting-started.md → docs/faq/basics/getting-started.md View File

@@ -1,3 +1,8 @@
---
uid: FAQ.Basics.GetStarted
title: Beginner Questions / How to Get Started
---

# Basic Concepts / Getting Started

## How do I add my bot to my server/guild?

docs/faq/images/dev-mode.png → docs/faq/basics/images/dev-mode.png View File


docs/faq/images/snowflake.png → docs/faq/basics/images/snowflake.png View File


docs/faq/samples/basics/cast.cs → docs/faq/basics/samples/cast.cs View File


docs/faq/samples/basics/emoji.cs → docs/faq/basics/samples/emoji.cs View File


docs/faq/Commands.md → docs/faq/commands/Commands.md View File

@@ -1,3 +1,8 @@
---
uid: FAQ.Commands
title: Questions about Commands
---

# Command-related Questions

## How can I restrict some of my commands so only certain users can execute them?
@@ -35,7 +40,7 @@ recognized as a single object. Please note that if your method has
multiple parameters, the remainder attribute can only be applied to
the last parameter.

[!code-csharp[Remainder](samples/commands/Remainder.cs)]
[!code-csharp[Remainder](samples/Remainder.cs)]

[RemainderAttribute]: xref:Discord.Commands.RemainderAttribute

@@ -52,11 +57,11 @@ persist throughout execution. Think of it like a chest that holds
whatever you throw at it that won't be affected by anything unless
you want it to. Note that you should also learn Microsoft's
implementation of [Dependency Injection] \([video]) before proceeding, as well
as how it works in [Discord.NET](../guides/commands/commands.md#usage-in-modules).
as how it works in [Discord.NET](xref:Guides.Commands.Intro#usage-in-modules).

A brief example of service and dependency injection can be seen below.

[!code-csharp[DI](samples/commands/DI.cs)]
[!code-csharp[DI](samples/DI.cs)]

[Dependency Injection]: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection
[video]: https://www.youtube.com/watch?v=QtDTfn8YxXg
@@ -83,11 +88,11 @@ the [DefaultRunMode] flag under `CommandServiceConfig`.

# [CommandAttribute](#tab/cmdattrib)

[!code-csharp[Command Attribute](samples/commands/runmode-cmdattrib.cs)]
[!code-csharp[Command Attribute](samples/runmode-cmdattrib.cs)]

# [CommandServiceConfig](#tab/cmdconfig)

[!code-csharp[Command Service Config](samples/commands/runmode-cmdconfig.cs)]
[!code-csharp[Command Service Config](samples/runmode-cmdconfig.cs)]

***


docs/faq/samples/commands/DI.cs → docs/faq/commands/samples/DI.cs View File


docs/faq/samples/commands/Remainder.cs → docs/faq/commands/samples/Remainder.cs View File


docs/faq/samples/commands/runmode-cmdattrib.cs → docs/faq/commands/samples/runmode-cmdattrib.cs View File


docs/faq/samples/commands/runmode-cmdconfig.cs → docs/faq/commands/samples/runmode-cmdconfig.cs View File


docs/faq/Glossary.md → docs/faq/misc/Glossary.md View File

@@ -1,3 +1,8 @@
---
uid: FAQ.Misc.Glossary
title: Common Terminologies / Glossary
---

# Glossary

## Common Types

docs/faq/Legacy.md → docs/faq/misc/Legacy.md View File

@@ -1,3 +1,8 @@
---
uid: FAQ.Misc.Legacy
title: Questions about Legacy Versions
---

# Legacy Questions

## X, Y, Z does not work! It doesn't return a valid value anymore.

+ 6
- 6
docs/faq/toc.yml View File

@@ -1,18 +1,18 @@
- name: Basic Concepts
items:
- name: Getting Started
href: getting-started.md
topicUid: FAQ.Basics.GetStarted
- name: Basic Operations
href: basic-operations.md
topicUid: FAQ.Basics.BasicOp
- name: Client Basics
href: client-basics.md
topicUid: FAQ.Basics.ClientBasics
- name: Command
items:
- name: Commands
href: commands.md
topicUid: FAQ.Commands
- name: Misc
items:
- name: Glossary
href: glossary.md
topicUid: FAQ.Misc.Glossary
- name: Legacy or Upgrade
href: legacy.md
topicUid: FAQ.Misc.Legacy

+ 5
- 0
docs/guides/commands/commands.md View File

@@ -1,3 +1,8 @@
---
uid: Guides.Commands.Intro
title: Introduction to the Command Service
---

# The Command Service

[Discord.Commands](xref:Discord.Commands) provides an attribute-based


+ 7
- 2
docs/guides/commands/post-execution.md View File

@@ -1,3 +1,8 @@
---
uid: Guides.Commands.PostExecution
title: Post-command Execution Handling
---

# Preface

When developing a command system or modules, you may want to consider
@@ -25,7 +30,7 @@ issue, working with `RunMode.Async`.
If your command is marked with `RunMode.Async`, [ExecuteAsync] will
return a successful [ExecuteResult] instead of whatever results
the actual command may return. Because of the way `RunMode.Async`
[works](../../faq/commands.md), handling within the command handler
[works](xref:FAQ.Commands), handling within the command handler
may not always achieve the desired effect.

## CommandExecuted Event
@@ -38,4 +43,4 @@ sucessfully executed** and is not prone to `RunMode.Async`'s
[CommandExecuted]: xref:Discord.Commands.CommandService.CommandExecuted
[ExecuteAsync]: xref:Discord.Commands.CommandService.ExecuteAsync*
[ExecuteResult]: xref:Discord.Commands.ExecuteResult
[Command Guide]: Commands.md
[Command Guide]: xref:Guides.Commands.Intro

+ 14
- 14
docs/guides/concepts/connections.md View File

@@ -1,21 +1,21 @@
---
uid: Guides.Concepts.ManageConnections
title: Managing Connections
---

In Discord.Net, once a client has been started, it will automatically
maintain a connection to Discord's gateway, until it is manually
maintain a connection to Discord's gateway until it is manually
stopped.

### Usage

To start a connection, invoke the `StartAsync` method on a client that
supports a WebSocket connection.

To end a connection, invoke the `StopAsync` method. This will
gracefully close any open WebSocket or UdpSocket connections.
supports a WebSocket connection; to end a connection, invoke the
`StopAsync` method. This will gracefully close any open WebSocket or
UdpSocket connections.

Since the Start/Stop methods only signal to an underlying connection
manager that a connection needs to be started, **they return before a
manager that a connection needs to be started, **they return before a
connection is actually made.**

As a result, you will need to hook into one of the connection-state
@@ -24,25 +24,25 @@ ready for use.

All clients provide a `Connected` and `Disconnected` event, which is
raised respectively when a connection opens or closes. In the case of
the DiscordSocketClient, this does **not** mean that the client is
the [DiscordSocketClient], this does **not** mean that the client is
ready to be used.

A separate event, `Ready`, is provided on DiscordSocketClient, which
A separate event, `Ready`, is provided on [DiscordSocketClient], which
is raised only when the client has finished guild stream or guild
sync, and has a complete guild cache.

[DiscordSocketClient]: xref:Discord.WebSocket.DiscordSocketClient
[DiscordRpcClient]: xref:Discord.Rpc.DiscordRpcClient

### Samples

[!code-csharp[Connection Sample](samples/events.cs)]

### Tips
### Reconnection

Avoid running long-running code on the gateway! If you deadlock the
gateway (as explained in [events]), the connection manager will be
unable to recover and reconnect.
> [!TIP]
> Avoid running long-running code on the gateway! If you deadlock the
> gateway (as explained in [events]), the connection manager will be
> unable to recover and reconnect.

Assuming the client disconnected because of a fault on Discord's end,
and not a deadlock on your end, we will always attempt to reconnect
@@ -52,4 +52,4 @@ Don't worry about trying to maintain your own connections, the
connection manager is designed to be bulletproof and never fail - if
your client doesn't manage to reconnect, you've found a bug!

[events]: events.md
[events]: xref:Guides.Concepts.Events

+ 5
- 4
docs/guides/concepts/entities.md View File

@@ -1,4 +1,5 @@
---
uid: Guides.Concepts.Entities
title: Entities
---

@@ -11,7 +12,7 @@ title: Entities
Discord.Net provides a versatile entity system for navigating the
Discord API.

### Inheritance
## Inheritance

Due to the nature of the Discord API, some entities are designed with
multiple variants; for example, `SocketUser` and `SocketGuildUser`.
@@ -30,14 +31,14 @@ But that doesn't mean a message _can't_ come from a
retrieve information about a guild from a message entity, you will
need to cast its channel object to a `SocketTextChannel`.

### Navigation
## Navigation

All socket entities have navigation properties on them, which allow
you to easily navigate to an entity's parent or children. As explained
above, you will sometimes need to cast to a more detailed version of
an entity to navigate to its parent.

### Accessing Entities
## Accessing Entities

The most basic forms of entities, `SocketGuild`, `SocketUser`, and
`SocketChannel` can be pulled from the DiscordSocketClient's global
@@ -56,6 +57,6 @@ entities, e.g. `SocketGuild.GetUser`, which returns a
`SocketGuildChannel`. Again, you may need to cast these objects to get
a variant of the type that you need.

### Sample
## Sample

[!code-csharp[Entity Sample](samples/entities.cs)]

+ 7
- 6
docs/guides/concepts/events.md View File

@@ -1,4 +1,5 @@
---
uid: Guides.Concepts.Events
title: Working with Events
---

@@ -12,7 +13,7 @@ event's parameters are passed directly into the handler.
This allows for events to be handled in an async context directly
instead of relying on `async void`.

### Usage
## Usage

To receive data from an event, hook into it using C#'s delegate
event pattern.
@@ -20,7 +21,7 @@ event pattern.
You may either opt to hook an event to an anonymous function (lambda)
or a named function.

### Safety
## Safety

All events are designed to be thread-safe; events are executed
synchronously off the gateway task in the same context as the gateway
@@ -41,7 +42,7 @@ a deadlock that will be impossible to recover from.
Exceptions in commands will be swallowed by the gateway and logged out
through the client's log method.

### Common Patterns
## Common Patterns

As you may know, events in Discord.Net are only given a signature of
`Func<T1, ..., Task>`. There is no room for predefined argument names,
@@ -51,7 +52,7 @@ directly.
That being said, there are a variety of common patterns that allow you
to infer what the parameters in an event mean.

#### Entity, Entity
### Entity, Entity

An event handler with a signature of `Func<Entity, Entity, Task>`
typically means that the first object will be a clone of the entity
@@ -60,7 +61,7 @@ model of the entity _after_ the change was made.

This pattern is typically only found on `EntityUpdated` events.

#### Cacheable
### Cacheable

An event handler with a signature of `Func<Cacheable, Entity, Task>`
means that the `before` state of the entity was not provided by the
@@ -78,6 +79,6 @@ object.
> **not** enabled by default. Set the `MessageCacheSize` flag in
> @Discord.WebSocket.DiscordSocketConfig to enable it.

### Sample
## Sample

[!code-csharp[Event Sample](samples/events.cs)]

+ 5
- 4
docs/guides/concepts/logging.md View File

@@ -1,4 +1,5 @@
---
uid: Guides.Concepts.Logging
title: Logging
---

@@ -10,7 +11,7 @@ dispatched over.
For more information about events in Discord.Net, see the [Events]
section.

[Events]: events.md
[Events]: xref:Guides.Concepts.Events

> [!WARNING]
> Due to the nature of Discord.Net's event system, all log event
@@ -19,7 +20,7 @@ section.
> to wrap your output in a `Task.Run` so the gateway thread does not
> become blocked while waiting for logging data to be written.

### Usage in Client(s)
## Usage in Client(s)

To receive log events, simply hook the Discord client's @Discord.Rest.BaseDiscordClient.Log
to a `Task` with a single parameter of type [LogMessage].
@@ -30,7 +31,7 @@ to a logging function to write their own messages.

[LogMessage]: xref:Discord.LogMessage

### Usage in Commands
## Usage in Commands

Discord.Net's [CommandService] also provides a @Discord.Commands.CommandService.Log
event, identical in signature to other log events.
@@ -42,6 +43,6 @@ and error can be found and handled.
[CommandService]: xref:Discord.Commands.CommandService
[CommandException]: xref:Discord.Commands.CommandException

### Sample
## Sample

[!code-csharp[Logging Sample](samples/logging.cs)]

+ 9
- 8
docs/guides/getting_started/first-bot.md View File

@@ -1,5 +1,6 @@
---
title: Getting Started
uid: Guides.GettingStarted.FirstBot
title: Start making a bot
---

# Making a Ping-Pong bot
@@ -25,8 +26,8 @@ account on Discord.
![Step 5](images/intro-create-bot.png)

6. Confirm the popup.
7. If this bot will be public, check "Public Bot." **Do not tick any
other options!**
7. If this bot will be public, check "Public Bot." **Do not tick any
other options!**

[Discord Applications Portal]: https://discordapp.com/developers/applications/me

@@ -55,7 +56,7 @@ through the OAuth2 flow.
## Connecting to Discord

If you have not already created a project and installed Discord.Net,
do that now. (see the [Installing](installing.md) section)
do that now. (see the [Installing](xref:Guides.GettingStarted.Installation) section)

### Async

@@ -109,7 +110,7 @@ the Console.

Finally, we can create a connection to Discord. Since we are writing
a bot, we will be using a [DiscordSocketClient] along with socket
entities. See the [terminology](terminology.md) if you're unsure of
entities. See the [terminology](xref:Guides.GettingStarted.Terminology) if you're unsure of
the differences.

To do so, create an instance of [DiscordSocketClient] in your async
@@ -161,7 +162,7 @@ online in Discord.
> for how to fix this.

[DiscordSocketClient]: xref:Discord.WebSocket.DiscordSocketClient
[installation guide]: installing.md#installing-on-net-standard-11
[installation guide]: xref:Guides.GettingStarted.Installation#installing-on-net-standard-11

### Handling a 'ping'

@@ -213,12 +214,12 @@ For your reference, you may view the [completed program].
[SocketMessage]: xref:Discord.WebSocket.SocketMessage
[SocketMessageChannel]: xref:Discord.WebSocket.ISocketMessageChannel
[completed program]: samples/intro/complete.cs
[Command Guide]: ../commands/commands.md
[Command Guide]: xref:Guides.Commands.Intro

# Building a bot with commands

This section will show you how to write a program that is ready for
[Commands](../commands/commands.md). Note that we will not be
[Commands](xref:Guides.Commands.Intro). Note that we will not be
explaining _how_ to write Commands or Services, it will only be
covering the general structure.



+ 1
- 0
docs/guides/getting_started/installing.md View File

@@ -1,4 +1,5 @@
---
uid: Guides.GettingStarted.Installation
title: Installing Discord.Net
---



+ 1
- 1
docs/guides/getting_started/terminology.md View File

@@ -1,5 +1,5 @@
---
uid: Terminology
uid: Guides.GettingStarted.Terminology
title: Terminology
---



+ 5
- 0
docs/guides/introduction/intro.md View File

@@ -1,3 +1,8 @@
---
uid: Guides.Introduction
title: Introduction to Discord.NET
---

# Introduction

## Looking to get started?


+ 11
- 11
docs/guides/toc.yml View File

@@ -1,28 +1,28 @@
- name: Introduction
href: introduction/intro.md
topicUid: Guides.Introduction
- name: Getting Started
items:
- name: Installation
href: getting_started/installing.md
topicUid: Guides.GettingStarted.Installation
- name: Your First Bot
href: getting_started/first-bot.md
topicUid: Guides.GettingStarted.FirstBot
- name: Terminology
href: getting_started/terminology.md
topicUid: Guides.GettingStarted.Terminology
- name: Basic Concepts
items:
- name: Logging Data
href: concepts/logging.md
topicUid: Guides.Concepts.Logging
- name: Working with Events
href: concepts/events.md
topicUid: Guides.Concepts.Events
- name: Managing Connections
href: concepts/connections.md
topicUid: Guides.Concepts.ManageConnections
- name: Entities
href: concepts/entities.md
topicUid: Guides.Concepts.Entities
- name: The Command Service
items:
- name: Command Guide
href: commands/commands.md
topicUid: Guides.Commands.Intro
- name: Post-execution Handling
href: commands/post-execution.md
topicUid: Guides.Commands.PostExecution
- name: Voice
href: voice/sending-voice.md
topicUid: Guides.Voice.SendingVoice

+ 1
- 0
docs/guides/voice/sending-voice.md View File

@@ -1,4 +1,5 @@
---
uid: Guides.Voice.SendingVoice
title: Sending Voice
---



+ 9
- 3
docs/index.md View File

@@ -1,3 +1,8 @@
---
uid: Root.Landing
title: Home
---

# Discord.Net Documentation

## What is Discord.NET?
@@ -8,9 +13,10 @@ interface with the [Discord API](https://discordapp.com/).
## Where to begin?

If this is your first time using Discord.Net, you should refer to the
[Intro](guides/introduction/intro.md) for tutorials.
More experienced users might refer to the
[API Documentation](api/index.md) for a breakdown of the individuals
[Intro](xref:Guides.Introduction) for tutorials.

More experienced users might want to refer to the
[API Documentation](xref:API.Docs) for a breakdown of the individual
objects in the library.

## Additional Resources


+ 3
- 1
docs/toc.yml View File

@@ -1,7 +1,9 @@
- name: Guides
href: guides/
topicUid: Guides.Introduction
- name: FAQ
href: faq/
topicUid: FAQ.Basics.GetStarted
- name: API Documentation
href: api/
homepage: api/index.md
topicUid: API.Docs

Loading…
Cancel
Save