Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit dece19d
Merge: fdaa689 e764daf
Author: Still Hsu <341464@gmail.com>
Date:   Mon May 21 11:47:47 2018 +0800

    Merge branch 'dev' into docs/faq-n-patches-offline

commit e764daf
Author: Quahu <quahuu@gmail.com>
Date:   Sun May 13 15:34:40 2018 +0200

    Add ViewChannel to Voice channel permissions (discord-net#1059)

    Previously, Voice channels did not have ViewChannel in their "all" permissions

commit 32fc2df
Author: Alex Gravely <tcbskater@hotmail.com>
Date:   Sat May 12 20:47:44 2018 -0400

    Remove unused field in EmbedFieldBuilder. (discord-net#1018)

commit 39dffe8
Author: Finite Reality <FiniteReality@users.noreply.github.com>
Date:   Sun May 13 01:46:07 2018 +0100

    Audit Logs implementation (discord-net#1055)

    * Copy audit logs impl from old branch and clean up

    I suck at using git, so I'm gonna use brute force.

    * Remove unnecessary TODOs

    Category channels do not provide any new information, and the other
    I forgot to remove beforehand

    * Add invite update data, clean up after feedback

    * Remove TODOs, add WebhookType enum for future use

    WebhookType is a future-use type, as currently audit logs are the only
    thing which may return it.

commit fdaa689
Author: Still Hsu <341464@gmail.com>
Date:   Wed May 9 06:04:59 2018 +0800

    Add explanation for RunMode

commit ea82c25
Author: Still Hsu <341464@gmail.com>
Date:   Tue May 8 16:30:48 2018 +0800

    Initial proofread of the articles

commit 124f1a2
Merge: 2555721 97c8931
Author: Still Hsu <341464@gmail.com>
Date:   Tue May 8 05:02:01 2018 +0800

    Merge branch 'dev' into docs/faq-n-patches-offline

commit 97c8931
Author: Still Hsu <341464@gmail.com>
Date:   Mon May 7 06:22:49 2018 +0800

    Implement GetBanAsync (discord-net#1056)

commit 2555721
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 16:11:19 2018 +0800

    Add details to SpotifyGame

commit c7b236d
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 15:58:23 2018 +0800

    Add more IGuild docs

commit 1bb06cc
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 15:40:31 2018 +0800

    Replace all langword placements with code block

commit ac47d84
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 15:22:17 2018 +0800

    Replace langword null to code block null instead

    - Because DocFX sucks at rendering langword

commit 0b15bbc
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 15:20:34 2018 +0800

    Add XML docs

commit 65d4e43
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 06:57:53 2018 +0800

    Add BaseSocketClient docs

commit 8f64c04
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 06:37:55 2018 +0800

    Replace note block

commit d8bb9e7
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 06:31:50 2018 +0800

    Add warning for bulk-delete endpoint

commit adae5ff
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 06:07:28 2018 +0800

    Fix missing Username prop

commit 3e59197
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 06:01:34 2018 +0800

    Add properties examples to overwrite

commit 0ad66f6
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 04:55:15 2018 +0800

    Fix minor consistencies & redundant impl

commit 124efdf
Author: Still Hsu <341464@gmail.com>
Date:   Sun May 6 04:40:14 2018 +0800

    XML Docs

commit 3aa5d36
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 18:22:46 2018 +0800

    Add 'last modified' plugin

    Source: https://github.com/Still34/DocFx.Plugin.LastModified
    Licensed under MIT License

commit 2014870
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 15:57:40 2018 +0800

    Fix letter-casing for files

commit f27d659
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 15:50:00 2018 +0800

    Document exposed TypeReaders

commit 5a824a5
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 15:44:15 2018 +0800

    Add missing exceptions

commit c2de0c0
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 15:40:16 2018 +0800

    Fix seealso for preconditions and add missing descriptions

commit 3a7d7ee
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 15:36:22 2018 +0800

    Minor fixes in documentations
    + Fix unescaped '<'
    + Fix typo

commit 45839bd
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 15:29:47 2018 +0800

    Add XML Docs

commit 9e62546
Merge: aea0678 bb4bb13
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 14:48:13 2018 +0800

    Merge branch 'dev' into docs/faq-n-patches-offline

commit aea0678
Merge: 27dc483 9ddd709
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 13:51:07 2018 +0800

    Merge branch 'docs/faq-n-patches-offline' of https://github.com/Still34/Discord.Net into docs/faq-n-patches-offline

commit 27dc483
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 13:50:27 2018 +0800

    Add XML Docs

commit baa8beb
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 13:49:42 2018 +0800

    Add XML Docs

commit 089f97a
Author: Still Hsu <341464@gmail.com>
Date:   Sat May 5 13:43:04 2018 +0800

    Add details regarding userbot support

commit bb4bb13
Author: Finite Reality <FiniteReality@users.noreply.github.com>
Date:   Fri May 4 11:42:54 2018 +0100

    Fix issues with discord-net#984, remove extraneous whitespace (discord-net#1051)

    - Removed unnecessary parameter in SocketVoiceServer

    - Moved SocketVoiceServer into Entities/Voice

    - Fixed a bug where trying to download the cached guild would throw

    - Fixed a potential bug where Discord might not give us a port when
      connecting to voice

commit 9ddd709
Merge: f197174 7cfed7f
Author: Still Hsu <341464@gmail.com>
Date:   Fri May 4 09:37:04 2018 +0800

    Merge branch 'dev' into docs/faq-n-patches-offline

commit f197174
Author: Still Hsu <341464@gmail.com>
Date:   Fri May 4 09:36:53 2018 +0800

    Fix embed docs consistency

commit 7cfed7f
Author: Alex Gravely <tcbskater@hotmail.com>
Date:   Thu May 3 21:30:13 2018 -0400

    Fix nullref when passing null to GetShardIdFor. (discord-net#1049)

commit e775853
Author: Luke <dev@crimsonxv.pro>
Date:   Fri May 4 02:29:51 2018 +0100

    Expose VoiceServerUpdate events (discord-net#984)

    * Expose VoiceServerUpdate events

    * Amend based on feedback

    * Move this out of guild entity

    * Fix namespace issue

    * Adjust based on feedback #2

    * Use cacheable instead

    * Change based on feedback

commit 157acc4
Author: Still Hsu <341464@gmail.com>
Date:   Thu May 3 23:03:35 2018 +0800

    Add tag examples

commit 57ea571
Author: Still Hsu <341464@gmail.com>
Date:   Thu May 3 22:48:33 2018 +0800

    Fix sample link & add missing pictures

commit 6769c37
Author: Still Hsu <341464@gmail.com>
Date:   Thu May 3 22:39:26 2018 +0800

    Compress some assets & add OAuth2 URL generator
  • Loading branch information
Still Hsu committed May 21, 2018
1 parent 02570a4 commit 954b913
Show file tree
Hide file tree
Showing 164 changed files with 3,109 additions and 567 deletions.
8 changes: 2 additions & 6 deletions docs/_overwrites/Commands/PreconditionAttribute.Overwrites.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
uid: Discord.Commands.PreconditionAttribute
seealso:
- linkId: Discord.Commands.ParameterPreconditionAttribute
remarks: *content
---

Expand All @@ -12,8 +10,6 @@ method-level for a command.

---
uid: Discord.Commands.ParameterPreconditionAttribute
seealso:
- linkId: Discord.Commands.PreconditionAttribute
remarks: *content
---

Expand All @@ -31,11 +27,11 @@ The following example creates a precondition to see if the user has
sufficient role required to access the command.

```cs
public class RequireRoleAtribute : PreconditionAttribute
public class RequireRoleAttribute : PreconditionAttribute
{
private readonly ulong _roleId;

public RequireRoleAtribute(ulong roleId)
public RequireRoleAttribute(ulong roleId)
{
_roleId = roleId;
}
Expand Down
174 changes: 174 additions & 0 deletions docs/_overwrites/Common/ObjectProperties.Overwrites.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
uid: Discord.GuildChannelProperties
example: [*content]
---

The following example uses @Discord.IGuildChannel.ModifyAsync* to
apply changes specified in the properties,

```cs
var channel = _client.GetChannel(id) as IGuildChannel;
if (channel == null) return;

await channel.ModifyAsync(x =>
{
x.Name = "new-name";
x.Position = channel.Position - 1;
});
```

---
uid: Discord.TextChannelProperties
example: [*content]
---

The following example uses @Discord.ITextChannel.ModifyAsync* to
apply changes specified in the properties,

```cs
var channel = _client.GetChannel(id) as ITextChannel;
if (channel == null) return;

await channel.ModifyAsync(x =>
{
x.Name = "cool-guys-only";
x.Topic = "This channel is only for cool guys and adults!!!";
x.Position = channel.Position - 1;
x.IsNsfw = true;
});
```

---
uid: Discord.VoiceChannelProperties
example: [*content]
---

The following example uses @Discord.IVoiceChannel.ModifyAsync* to
apply changes specified in the properties,

```cs
var channel = _client.GetChannel(id) as IVoiceChannel;
if (channel == null) return;

await channel.ModifyAsync(x =>
{
x.UserLimit = 5;
});
```

---
uid: Discord.EmoteProperties
example: [*content]
---

The following example uses @Discord.IGuild.ModifyEmoteAsync* to
apply changes specified in the properties,

```cs
await guild.ModifyEmoteAsync(x =>
{
x.Name = "blobo";
});
```

---
uid: Discord.MessageProperties
example: [*content]
---

The following example uses @Discord.IUserMessage.ModifyAsync* to
apply changes specified in the properties,

```cs
var message = await channel.SendMessageAsync("boo");
await Task.Delay(TimeSpan.FromSeconds(1));
await message.ModifyAsync(x => x.Content = "boi");
```

---
uid: Discord.GuildProperties
example: [*content]
---

The following example uses @Discord.IGuild.ModifyAsync* to
apply changes specified in the properties,

```cs
var guild = _client.GetGuild(id);
if (guild == null) return;

await guild.ModifyAsync(x =>
{
x.Name = "VERY Fast Discord Running at Incredible Hihg Speed";
});
```

---
uid: Discord.RoleProperties
example: [*content]
---

The following example uses @Discord.IRole.ModifyAsync* to
apply changes specified in the properties,

```cs
var role = guild.GetRole(id);
if (role == null) return;

await role.ModifyAsync(x =>
{
x.Name = "cool boi";
x.Color = Color.Gold;
x.Hoist = true;
x.Mentionable = true;
});
```

---
uid: Discord.GuildUserProperties
example: [*content]
---

The following example uses @Discord.IGuildUser.ModifyAsync* to
apply changes specified in the properties,

```cs
var user = guild.GetUser(id);
if (user == null) return;

await user.ModifyAsync(x =>
{
x.Nickname = "I need healing";
});
```

---
uid: Discord.SelfUserProperties
example: [*content]
---

The following example uses @Discord.ISelfUser.ModifyAsync* to
apply changes specified in the properties,

```cs
await selfUser.ModifyAsync(x =>
{
x.Username = "Mercy";
});
```

---
uid: Discord.WebhookProperties
example: [*content]
---

The following example uses @Discord.IWebhook.ModifyAsync* to
apply changes specified in the properties,

```cs
await webhook.ModifyAsync(x =>
{
x.Name = "very fast fox";
x.ChannelId = newChannelId;
});
```
Binary file not shown.
5 changes: 3 additions & 2 deletions docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
"dest": "_site",
"template": [
"default",
"_template/light-dark-theme"
"_template/light-dark-theme",
"_template/lastmodified"
],
"postProcessors": [ "ExtractSearchIndex" ],
"postProcessors": [ "ExtractSearchIndex", "LastModifiedPostProcessor" ],
"overwrite": "_overwrites/**/**.md",
"globalMetadata": {
"_appTitle": "Discord.Net Documentation",
Expand Down
8 changes: 4 additions & 4 deletions docs/faq/basics/basic-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: Questions about Basic Operations
## How should I safely check a type?

> [!WARNING]
> Direct casting (e.g. `(Type)type`) is **the least recommended**
> Direct casting (e.g., `(Type)type`) is **the least recommended**
> way of casting, as it *can* throw an [InvalidCastException]
> when the object isn't the desired type.
>
Expand All @@ -28,9 +28,9 @@ A good and safe casting example:
## How do I send a message?

> [!TIP]
> The [GetChannel] method by default returns an [IChannel].
> This means channels such as [IVoiceChannel], [ICategoryChannel]
> can be returned. This is why that you cannot send message
> The [GetChannel] method by default returns an [IChannel], allowing
> channel types such as [IVoiceChannel], [ICategoryChannel]
> to be returned; consequently, you cannot send a message
> to channels like those.
Any implementation of [IMessageChannel] has a [SendMessageAsync]
Expand Down
20 changes: 12 additions & 8 deletions docs/faq/basics/client-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,36 @@ title: Basic Questions about Client
## My client keeps returning 401 upon logging in!

> [!WARNING]
> Userbot/selfbot (logging in with a user token) is not
> officially supported with this library.
> Userbot/selfbot (logging in with a user token) is no
> longer supported with this library starting from 2.0, as
> logging in under a user account may result in account termination.
>
> Logging in under a user account may result in account
> termination!
> For more information, see issue [827] & [958], as well as the official
> [Discord API Terms of Service].
There are few possible reasons why this may occur.

1. You are not using the appropriate [TokenType]. If you are using a
bot account created from the Discord Developer portal, you should
be using `TokenType.Bot`.
2. You are not using the correct login credentials. Please keep in
mind that tokens is different from a *client secret*.
mind that a token is **different** from a *client secret*.

[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

## 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?

Your bot should **not** attempt to interact in any way with
guilds/servers until the [Ready] event fires. When the bot
connects, it first has to download guild information from
Discord in order for you to get access to any server
Discord for you to get access to any server
information; the client is not ready at this point.

Technically, the [GuildAvailable] event fires once the data for a
particular guild has downloaded; however, it's best to wait for all
particular guild has downloaded; however, it is best to wait for all
guilds to be downloaded. Once all downloads are complete, the [Ready]
event is triggered, then you can proceed to do whatever you like.

Expand All @@ -42,7 +46,7 @@ event is triggered, then you can proceed to do whatever you like.

## How do I get a message's previous content when that message is edited?

If you need to do anything with messages (e.g. checking Reactions,
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](xref:Guides.Concepts.Events#cacheable).
Expand Down
28 changes: 15 additions & 13 deletions docs/faq/basics/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,27 @@ title: Beginner Questions / How to Get Started
## How do I add my bot to my server/guild?

You can do so by using the [permission calculator] provided
by FiniteReality.
This tool allows you to set the permissions that the bot will be
added with, and invite the bot into your guild. With this method,
bots will also be assigned their own special roles that normal users
cannot use; this is what we call a `Managed` role, and this is a much
safer method of permission management than to create a role that any
users can be assigned to.

by [FiniteReality].
This tool allows you to set permissions that the bot will be assigned
with, and invite the bot into your guild. With this method, bots will
also be assigned a unique role that a regular user cannot use; this
is what we call a `Managed` role. Because you cannot assign this
role to any other users, it is much safer than creating a single
role which, intentionally or not, can be applied to other users
to escalate their privilege.

[FiniteReality]: https://github.com/FiniteReality/permissions-calculator
[permission calculator]: https://finitereality.github.io/permissions-calculator

## What is a token?

A token is a credential used to log into an account. This information
should be kept **private** and for your eyes only. Anyone with your
token can log into your account. This applies to both user and bot
accounts. That also means that you should never ever hardcode your
token or add it into source control, as your identity may be stolen
by scrape bots on the internet that scours through constantly to
obtain a token.
token can log into your account. This risk applies to both user
and bot accounts. That also means that you should **never** hardcode
your token or add it into source control, as your identity may be
stolen by scrape bots on the internet that scours through
constantly to obtain a token.

## What is a client/user/object ID?

Expand Down
Loading

0 comments on commit 954b913

Please sign in to comment.