docs: September 2019 Documentation Update (#1379)

* 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
This commit is contained in:
Still Hsu
2019-09-23 07:06:57 +08:00
committed by Christopher F
parent 7b9029dd91
commit fd3810e9fe
23 changed files with 165 additions and 127 deletions

View File

@@ -5,9 +5,18 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}">
<meta property="og:title" content="{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}">
{{#_description}}<meta property="og:description" content="{{_description}}">{{/_description}}
<meta property="og:locale" content="en-us">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Discord.Net Docs">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/discord-net/Discord.Net/docs/marketing/logo/PackageLogo.png">
<meta property="og:image:alt" content="Discord.Net Logo">
<meta name="theme-color" content="#995EA7"/>
<meta name="generator" content="docfx {{_docfxVersion}}">
{{#_description}}<meta name="description" content="{{_description}}">{{/_description}}
<meta property="docfx:navrel" content="{{_navRel}}">
<meta property="docfx:tocrel" content="{{_tocRel}}">
<meta id="docfx-style:rel" content="{{_rel}}">
<link rel="preload" href="{{_rel}}styles/search-worker.js" as="script">
<link rel="preload" href="{{_rel}}fonts/glyphicons-halflings-regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="shortcut icon" href="{{_rel}}{{{_appFaviconPath}}}{{^_appFaviconPath}}favicon.ico{{/_appFaviconPath}}">
@@ -18,10 +27,6 @@
<link rel="stylesheet" href="{{_rel}}styles/material.css">
<link rel="stylesheet" href="{{_rel}}styles/theme-switcher.css">
<link href="https://cdn.rawgit.com/noelboss/featherlight/1.7.6/release/featherlight.min.css" type="text/css" rel="stylesheet" />
<meta name="theme-color" content="#99AAB5"/>
<meta property="docfx:navrel" content="{{_navRel}}">
<meta property="docfx:tocrel" content="{{_tocRel}}">
<meta id="docfx-style:rel" content="{{_rel}}">
{{#_noindex}}<meta name="searchOption" content="noindex">{{/_noindex}}
{{#_enableSearch}}<meta property="docfx:rel" content="{{_rel}}">{{/_enableSearch}}
{{#_enableNewTab}}<meta property="docfx:newtab" content="true">{{/_enableNewTab}}

View File

@@ -3,8 +3,6 @@
<script type="text/javascript" src="{{_rel}}styles/docfx.vendor.js"></script>
<script type="text/javascript" src="{{_rel}}styles/docfx.js"></script>
<script type="text/javascript" src="{{_rel}}styles/main.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/noelboss/featherlight/master/release/featherlight.min.js" charset="utf-8"></script>
<script type="text/javascript" src="{{_rel}}styles/plugin-featherlight.js"></script>
<script type="text/javascript" src="{{_rel}}styles/styleswitcher.js"></script>
<script type="text/javascript" src="https://malsup.github.io/jquery.corner.js"></script>
<script type="text/javascript" src="{{_rel}}styles/cornerify.js"></script>

View File

@@ -6,7 +6,6 @@ body {
font-display: optional;
height: 100%;
font-size: 15px;
scroll-behavior: smooth;
}
code{
@@ -92,6 +91,10 @@ article.content h6{
line-height: 140%;
}
.sideaffix > div.contribution {
margin-bottom: 0;
}
header .navbar {
border-width: 0 0 0px;
border-radius: 0;

View File

@@ -1,37 +0,0 @@
// MIT License
// Copyright (c) 2017 Roel Fauconnier
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
$(document).ready(function() {
//find all images, but not the logo, and add the lightbox
$('img').not('#logo').each(function(){
var $img = $(this);
var filename = $img.attr('src')
//add cursor
$img.css('cursor','zoom-in');
$img.css('cursor','-moz-zoom-in');
$img.css('cursor','-webkit-zoom-in');
//add featherlight
$img.attr('alt', filename);
$img.featherlight(filename);
});
});

View File

@@ -35,7 +35,8 @@
"**/images/**",
"**/samples/**",
"langwordMapping.yml",
"marketing/logo/SVG/**.svg",
"marketing/logo/**.svg",
"marketing/logo/**.png",
"favicon.ico"
]
}],
@@ -50,7 +51,7 @@
"overwrite": "_overwrites/**/**.md",
"globalMetadata": {
"_appTitle": "Discord.Net Documentation",
"_appFooter": "Discord.Net (c) 2015-2019 2.0.1",
"_appFooter": "Discord.Net (c) 2015-2019 2.1.1",
"_enableSearch": true,
"_appLogoPath": "marketing/logo/SVG/Logomark Purple.svg",
"_appFaviconPath": "favicon.ico"

View File

@@ -146,23 +146,6 @@ method with the application's "token."
> Pay attention to what you are copying from the developer portal!
> A token is not the same as the application's "client secret."
> [!IMPORTANT]
> Your bot's token can be used to gain total access to your bot, so
> **do not** share this token with anyone else! You should store this
> token in an external source if you plan on distributing
> the source code for your bot.
>
> In the following example, we retrieve the token from the environment
> variable `DiscordToken`. Please note that this is *not* designed to
> be used in a production environment, as the secrets are stored in
> plain-text.
>
> For information on how to set an environment variable, please see
> instructions below,
>
> * Windows: [How to Create Environment Variables Shortcut in Windows](https://www.tenforums.com/tutorials/121742-create-environment-variables-shortcut-windows.html)
> * Linux: [How To Read and Set Environmental and Shell Variables on a Linux VPS](https://www.digitalocean.com/community/tutorials/how-to-read-and-set-environmental-and-shell-variables-on-a-linux-vps)
> * macOS: [How do I set environment variables on OS X?](https://apple.stackexchange.com/questions/106778/how-do-i-set-environment-variables-on-os-x)
We may now invoke the client's [StartAsync] method, which will
start connection/reconnection logic. It is important to note that
@@ -175,6 +158,22 @@ Finally, we will want to block the async main method from returning
when running the application. To do this, we can await an infinite delay
or any other blocking method, such as reading from the console.
> [!IMPORTANT]
> Your bot's token can be used to gain total access to your bot, so
> **do not** share this token with anyone else! You should store this
> token in an external source if you plan on distributing
> the source code for your bot.
>
> In the following example, we retrieve the token from a pre-defined
> variable, which is **NOT** secure, especially if you plan on
> distributing the application in any shape or form.
>
> We recommend alternative storage such as
> [Environment Variables], an external configuration file, or a
> secrets manager for safe-handling of secrets.
>
> [Environment Variables]: https://en.wikipedia.org/wiki/Environment_variable
The following lines can now be added:
[!code-csharp[Create client](samples/first-bot/client.cs)]

View File

@@ -78,7 +78,7 @@ published to our [MyGet feed]. See
### [Using dotnet CLI](#tab/dotnet-cli)
1. Launch your terminal
1. Launch a terminal of your choice
2. Navigate to where your `*.csproj` is located
3. Enter `dotnet add package Discord.Net`
@@ -90,7 +90,7 @@ In order to compile Discord.Net, you will need the following:
### Using Visual Studio
* [Visual Studio 2017](https://www.visualstudio.com/)
* [Visual Studio 2019](https://visualstudio.microsoft.com/)
* [.NET Core SDK]
The .NET Core and Docker workload is required during Visual Studio
@@ -109,7 +109,7 @@ When running any Discord.Net-powered bot on an older operating system
you may encounter a @System.PlatformNotSupportedException upon
connecting.
You may resolve this by either targeting .NET Core 2.1 or later, or
You may resolve this by either targeting .NET Core 2.1 or higher, or
by installing one or more custom packages as listed below.
#### [Targeting .NET Core 2.1](#tab/core2-1)
@@ -141,4 +141,4 @@ over the default ones.
***
[.NET Core SDK]: https://www.microsoft.com/net/download/
[.NET Core SDK]: https://dotnet.microsoft.com/download

View File

@@ -53,7 +53,7 @@ adding the feed to your package source.
### [Using dotnet CLI](#tab/cli)
1. Launch your terminal
1. Launch a terminal of your choice
2. Navigate to where your `*.csproj` is located
3. Type `dotnet add package Discord.Net --source https://www.myget.org/F/discord-net/api/v3/index.json`

View File

@@ -2,22 +2,22 @@ private DiscordSocketClient _client;
public async Task MainAsync()
{
_client = new DiscordSocketClient();
_client = new DiscordSocketClient();
_client.Log += Log;
// You can assign your bot token to a string, and pass that in to connect.
// This however is insecure, particularly if you plan to have your code hosted in a repository.
_client.Log += Log;
// You can assign your bot token to a string, and pass that in to connect.
// This is, however, insecure, particularly if you plan to have your code hosted in a public repository.
var token = "token";
// Some alternative options would be to keep your token in an Environment Variable or a standalone file.
// Some alternative options would be to keep your token in an Environment Variable or a standalone file.
// var token = Environment.GetEnvironmentVariable("NameOfYourEnvironmentVariable");
// var token = File.ReadAllText("token.txt");
// var token = JsonConvert.DeserializeObject<AConfigurationClass>(File.ReadAllText("config.json")).Token;
await _client.LoginAsync(TokenType.Bot, token);
await _client.StartAsync();
await _client.LoginAsync(TokenType.Bot, token);
await _client.StartAsync();
// Block this task until the program is closed.
await Task.Delay(-1);
}
// Block this task until the program is closed.
await Task.Delay(-1);
}

View File

@@ -5,7 +5,13 @@ title: Home
# Discord.Net Documentation
<div class="big-logo logo-switcher" />
<div class="big-logo logo-switcher"></div>
[![GitHub](https://img.shields.io/github/last-commit/discord-net/discord.net?style=plastic)](https://github.com/discord-net/Discord.Net)
[![NuGet](https://img.shields.io/nuget/vpre/Discord.Net.svg?maxAge=2592000?style=plastic)](https://www.nuget.org/packages/Discord.Net)
[![MyGet](https://img.shields.io/myget/discord-net/vpre/Discord.Net.svg)](https://www.myget.org/feed/Packages/discord-net)
[![Build Status](https://dev.azure.com/discord-net/Discord.Net/_apis/build/status/discord-net.Discord.Net?branchName=dev)](https://dev.azure.com/discord-net/Discord.Net/_build/latest?definitionId=1&branchName=dev)
[![Discord](https://discordapp.com/api/guilds/81384788765712384/widget.png)](https://discord.gg/jkrBmQR)
## What is Discord.Net?
@@ -20,11 +26,3 @@ If this is your first time using Discord.Net, you should refer to the
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
- [Discord API Guild](https://discord.gg/discord-api) - Look for `#dotnet_discord-net`
- [GitHub](https://github.com/RogueException/Discord.Net/)
- [NuGet](https://www.nuget.org/packages/Discord.Net/)
- [MyGet Feed](https://www.myget.org/feed/Packages/discord-net) - Add-ons and nightly builds
- [AppVeyor CI](https://ci.appveyor.com/project/RogueException/discord-net) - Nightly builds via Continuous Integration

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 11 KiB