mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
547 lines
26 KiB
HTML
547 lines
26 KiB
HTML
<!DOCTYPE html>
|
|
<!--[if IE]><![endif]-->
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<title>Class UserExtensions
|
|
</title>
|
|
<meta name="viewport" content="width=device-width">
|
|
<meta name="title" content="Class UserExtensions
|
|
">
|
|
<meta name="generator" content="docfx 2.50.0.0">
|
|
|
|
<link rel="shortcut icon" href="../favicon.ico">
|
|
<link rel="stylesheet" href="../styles/docfx.vendor.css">
|
|
<link rel="stylesheet" href="../styles/docfx.css">
|
|
<link rel="stylesheet" href="../styles/main.css">
|
|
<meta property="docfx:navrel" content="">
|
|
<meta property="docfx:tocrel" content="toc.html">
|
|
|
|
|
|
|
|
</head>
|
|
<body data-spy="scroll" data-target="#affix" data-offset="120">
|
|
<div id="wrapper">
|
|
<header>
|
|
|
|
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
|
|
<span class="sr-only">Toggle navigation</span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
</button>
|
|
|
|
<a class="navbar-brand" href="../index.html">
|
|
<img id="logo" class="svg" src="../logo.svg" alt="">
|
|
</a>
|
|
</div>
|
|
<div class="collapse navbar-collapse" id="navbar">
|
|
<form class="navbar-form navbar-right" role="search" id="search">
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="subnav navbar navbar-default">
|
|
<div class="container hide-when-search" id="breadcrumb">
|
|
<ul class="breadcrumb">
|
|
<li></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<div role="main" class="container body-content hide-when-search">
|
|
|
|
<div class="sidenav hide-when-search">
|
|
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
|
|
<div class="sidetoggle collapse" id="sidetoggle">
|
|
<div id="sidetoc"></div>
|
|
</div>
|
|
</div>
|
|
<div class="article row grid-right">
|
|
<div class="col-md-10">
|
|
<article class="content wrap" id="_content" data-uid="Discord.UserExtensions">
|
|
|
|
|
|
<h1 id="Discord_UserExtensions" data-uid="Discord.UserExtensions" class="text-break">Class UserExtensions
|
|
</h1>
|
|
<div class="markdown level0 summary"><p>An extension class for various Discord user objects.</p>
|
|
</div>
|
|
<div class="markdown level0 conceptual"></div>
|
|
<div class="inheritance">
|
|
<h5>Inheritance</h5>
|
|
<div class="level0"><span class="xref">System.Object</span></div>
|
|
<div class="level1"><span class="xref">UserExtensions</span></div>
|
|
</div>
|
|
<div class="inheritedMembers">
|
|
<h5>Inherited Members</h5>
|
|
<div>
|
|
<span class="xref">System.Object.ToString()</span>
|
|
</div>
|
|
<div>
|
|
<span class="xref">System.Object.Equals(System.Object)</span>
|
|
</div>
|
|
<div>
|
|
<span class="xref">System.Object.Equals(System.Object, System.Object)</span>
|
|
</div>
|
|
<div>
|
|
<span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
|
|
</div>
|
|
<div>
|
|
<span class="xref">System.Object.GetHashCode()</span>
|
|
</div>
|
|
<div>
|
|
<span class="xref">System.Object.GetType()</span>
|
|
</div>
|
|
<div>
|
|
<span class="xref">System.Object.MemberwiseClone()</span>
|
|
</div>
|
|
</div>
|
|
<h6><strong>Namespace</strong>: <a class="xref" href="Discord.html">Discord</a></h6>
|
|
<h6><strong>Assembly</strong>: Discord.Net.Core.dll</h6>
|
|
<h5 id="Discord_UserExtensions_syntax">Syntax</h5>
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static class UserExtensions</code></pre>
|
|
</div>
|
|
<h3 id="methods">Methods
|
|
</h3>
|
|
<span class="small pull-right mobile-hide">
|
|
<span class="divider">|</span>
|
|
<a href="https://github.com/goaaats/Discord.Net/new/819a325cec923e4a817ab2f08be5c7bbe0d775d0/apiSpec/new?filename=Discord_UserExtensions_BanAsync_Discord_IGuildUser_System_Int32_System_String_Discord_RequestOptions_.md&value=---%0Auid%3A%20Discord.UserExtensions.BanAsync(Discord.IGuildUser%2CSystem.Int32%2CSystem.String%2CDiscord.RequestOptions)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
|
|
</span>
|
|
<span class="small pull-right mobile-hide">
|
|
<a href="https://github.com/goaaats/Discord.Net/blob/819a325cec923e4a817ab2f08be5c7bbe0d775d0/src/Discord.Net.Core/Extensions/UserExtensions.cs/#L161">View Source</a>
|
|
</span>
|
|
<a id="Discord_UserExtensions_BanAsync_" data-uid="Discord.UserExtensions.BanAsync*"></a>
|
|
<h4 id="Discord_UserExtensions_BanAsync_Discord_IGuildUser_System_Int32_System_String_Discord_RequestOptions_" data-uid="Discord.UserExtensions.BanAsync(Discord.IGuildUser,System.Int32,System.String,Discord.RequestOptions)">BanAsync(IGuildUser, Int32, String, RequestOptions)</h4>
|
|
<div class="markdown level1 summary"><p>Bans the user from the guild and optionally prunes their recent messages.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
<h5 class="decalaration">Declaration</h5>
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static Task BanAsync(this IGuildUser user, int pruneDays = 0, string reason = null, RequestOptions options = null)</code></pre>
|
|
</div>
|
|
<h5 class="parameters">Parameters</h5>
|
|
<table class="table table-bordered table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Name</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.IGuildUser.html">IGuildUser</a></td>
|
|
<td><span class="parametername">user</span></td>
|
|
<td><p>The user to ban.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.Int32</span></td>
|
|
<td><span class="parametername">pruneDays</span></td>
|
|
<td><p>The number of days to remove messages from this <code data-dev-comment-type="paramref" class="paramref">user</code> for - must be between [0, 7]</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.String</span></td>
|
|
<td><span class="parametername">reason</span></td>
|
|
<td><p>The reason of the ban to be written in the audit log.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.RequestOptions.html">RequestOptions</a></td>
|
|
<td><span class="parametername">options</span></td>
|
|
<td><p>The options to be used when sending the request.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h5 class="returns">Returns</h5>
|
|
<table class="table table-bordered table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><span class="xref">System.Threading.Tasks.Task</span></td>
|
|
<td><p>A task that represents the asynchronous operation for banning a user.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h5 class="exceptions">Exceptions</h5>
|
|
<table class="table table-bordered table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Condition</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><span class="xref">System.ArgumentException</span></td>
|
|
<td><p><code data-dev-comment-type="paramref" class="paramref">pruneDays</code> is not between 0 to 7.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<span class="small pull-right mobile-hide">
|
|
<span class="divider">|</span>
|
|
<a href="https://github.com/goaaats/Discord.Net/new/819a325cec923e4a817ab2f08be5c7bbe0d775d0/apiSpec/new?filename=Discord_UserExtensions_SendFileAsync_Discord_IUser_System_IO_Stream_System_String_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions_.md&value=---%0Auid%3A%20Discord.UserExtensions.SendFileAsync(Discord.IUser%2CSystem.IO.Stream%2CSystem.String%2CSystem.String%2CSystem.Boolean%2CDiscord.Embed%2CDiscord.RequestOptions)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
|
|
</span>
|
|
<span class="small pull-right mobile-hide">
|
|
<a href="https://github.com/goaaats/Discord.Net/blob/819a325cec923e4a817ab2f08be5c7bbe0d775d0/src/Discord.Net.Core/Extensions/UserExtensions.cs/#L83">View Source</a>
|
|
</span>
|
|
<a id="Discord_UserExtensions_SendFileAsync_" data-uid="Discord.UserExtensions.SendFileAsync*"></a>
|
|
<h4 id="Discord_UserExtensions_SendFileAsync_Discord_IUser_System_IO_Stream_System_String_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions_" data-uid="Discord.UserExtensions.SendFileAsync(Discord.IUser,System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions)">SendFileAsync(IUser, Stream, String, String, Boolean, Embed, RequestOptions)</h4>
|
|
<div class="markdown level1 summary"><p>Sends a file to this message channel with an optional caption.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
<h5 class="decalaration">Declaration</h5>
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static Task<IUserMessage> SendFileAsync(this IUser user, Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)</code></pre>
|
|
</div>
|
|
<h5 class="parameters">Parameters</h5>
|
|
<table class="table table-bordered table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Name</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.IUser.html">IUser</a></td>
|
|
<td><span class="parametername">user</span></td>
|
|
<td><p>The user to send the DM to.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.IO.Stream</span></td>
|
|
<td><span class="parametername">stream</span></td>
|
|
<td><p>The <span class="xref">System.IO.Stream</span> of the file to be sent.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.String</span></td>
|
|
<td><span class="parametername">filename</span></td>
|
|
<td><p>The name of the attachment.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.String</span></td>
|
|
<td><span class="parametername">text</span></td>
|
|
<td><p>The message to be sent.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.Boolean</span></td>
|
|
<td><span class="parametername">isTTS</span></td>
|
|
<td><p>Whether the message should be read aloud by Discord or not.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.Embed.html">Embed</a></td>
|
|
<td><span class="parametername">embed</span></td>
|
|
<td><p>The <a class="xref" href="Discord.EmbedType.html#Discord_EmbedType_Rich">Rich</a> <a class="xref" href="Discord.Embed.html">Embed</a> to be sent.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.RequestOptions.html">RequestOptions</a></td>
|
|
<td><span class="parametername">options</span></td>
|
|
<td><p>The options to be used when sending the request.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h5 class="returns">Returns</h5>
|
|
<table class="table table-bordered table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><span class="xref">System.Threading.Tasks.Task</span><<a class="xref" href="Discord.IUserMessage.html">IUserMessage</a>></td>
|
|
<td><p>A task that represents an asynchronous send operation for delivering the message. The task result
|
|
contains the sent message.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h5 id="Discord_UserExtensions_SendFileAsync_Discord_IUser_System_IO_Stream_System_String_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions__remarks">Remarks</h5>
|
|
<div class="markdown level1 remarks"><p>This method attempts to send an attachment as a direct-message to the user.</p>
|
|
<div class="WARNING"><h5>warning</h5><p>
|
|
<p>
|
|
Please note that this method <strong>will</strong> throw an <a class="xref" href="Discord.Net.HttpException.html">HttpException</a>
|
|
if the user cannot receive DMs due to privacy reasons or if the user has the sender blocked.
|
|
</p>
|
|
<p>
|
|
You may want to consider catching for <a class="xref" href="Discord.Net.HttpException.html#Discord_Net_HttpException_DiscordCode">DiscordCode</a>
|
|
<code>50007</code> when using this method.
|
|
</p>
|
|
</p></div>
|
|
<div class="NOTE"><h5>note</h5><p>
|
|
If you wish to upload an image and have it embedded in a <a class="xref" href="Discord.EmbedType.html#Discord_EmbedType_Rich">Rich</a> embed,
|
|
you may upload the file and refer to the file with "attachment://filename.ext" in the
|
|
<a class="xref" href="Discord.EmbedBuilder.html#Discord_EmbedBuilder_ImageUrl">ImageUrl</a>. See the example section for its usage.
|
|
</p></div>
|
|
</div>
|
|
<h5 id="Discord_UserExtensions_SendFileAsync_Discord_IUser_System_IO_Stream_System_String_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions__examples">Examples</h5>
|
|
<p>The following example uploads a streamed image that will be called <code>b1nzy.jpg</code> embedded inside a
|
|
rich embed to the channel.</p>
|
|
<pre><code class="lang-cs">await channel.SendFileAsync(b1nzyStream, "b1nzy.jpg",
|
|
embed: new EmbedBuilder {ImageUrl = "attachment://b1nzy.jpg"}.Build());</code></pre>
|
|
|
|
<span class="small pull-right mobile-hide">
|
|
<span class="divider">|</span>
|
|
<a href="https://github.com/goaaats/Discord.Net/new/819a325cec923e4a817ab2f08be5c7bbe0d775d0/apiSpec/new?filename=Discord_UserExtensions_SendFileAsync_Discord_IUser_System_String_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions_.md&value=---%0Auid%3A%20Discord.UserExtensions.SendFileAsync(Discord.IUser%2CSystem.String%2CSystem.String%2CSystem.Boolean%2CDiscord.Embed%2CDiscord.RequestOptions)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
|
|
</span>
|
|
<span class="small pull-right mobile-hide">
|
|
<a href="https://github.com/goaaats/Discord.Net/blob/819a325cec923e4a817ab2f08be5c7bbe0d775d0/src/Discord.Net.Core/Extensions/UserExtensions.cs/#L140">View Source</a>
|
|
</span>
|
|
<a id="Discord_UserExtensions_SendFileAsync_" data-uid="Discord.UserExtensions.SendFileAsync*"></a>
|
|
<h4 id="Discord_UserExtensions_SendFileAsync_Discord_IUser_System_String_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions_" data-uid="Discord.UserExtensions.SendFileAsync(Discord.IUser,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions)">SendFileAsync(IUser, String, String, Boolean, Embed, RequestOptions)</h4>
|
|
<div class="markdown level1 summary"><p>Sends a file via DM with an optional caption.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
<h5 class="decalaration">Declaration</h5>
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static Task<IUserMessage> SendFileAsync(this IUser user, string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)</code></pre>
|
|
</div>
|
|
<h5 class="parameters">Parameters</h5>
|
|
<table class="table table-bordered table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Name</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.IUser.html">IUser</a></td>
|
|
<td><span class="parametername">user</span></td>
|
|
<td><p>The user to send the DM to.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.String</span></td>
|
|
<td><span class="parametername">filePath</span></td>
|
|
<td><p>The file path of the file.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.String</span></td>
|
|
<td><span class="parametername">text</span></td>
|
|
<td><p>The message to be sent.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.Boolean</span></td>
|
|
<td><span class="parametername">isTTS</span></td>
|
|
<td><p>Whether the message should be read aloud by Discord or not.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.Embed.html">Embed</a></td>
|
|
<td><span class="parametername">embed</span></td>
|
|
<td><p>The <a class="xref" href="Discord.EmbedType.html#Discord_EmbedType_Rich">Rich</a> <a class="xref" href="Discord.Embed.html">Embed</a> to be sent.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.RequestOptions.html">RequestOptions</a></td>
|
|
<td><span class="parametername">options</span></td>
|
|
<td><p>The options to be used when sending the request.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h5 class="returns">Returns</h5>
|
|
<table class="table table-bordered table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><span class="xref">System.Threading.Tasks.Task</span><<a class="xref" href="Discord.IUserMessage.html">IUserMessage</a>></td>
|
|
<td><p>A task that represents an asynchronous send operation for delivering the message. The task result
|
|
contains the sent message.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h5 id="Discord_UserExtensions_SendFileAsync_Discord_IUser_System_String_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions__remarks">Remarks</h5>
|
|
<div class="markdown level1 remarks"><p>This method attempts to send an attachment as a direct-message to the user.</p>
|
|
<div class="WARNING"><h5>warning</h5><p>
|
|
<p>
|
|
Please note that this method <strong>will</strong> throw an <a class="xref" href="Discord.Net.HttpException.html">HttpException</a>
|
|
if the user cannot receive DMs due to privacy reasons or if the user has the sender blocked.
|
|
</p>
|
|
<p>
|
|
You may want to consider catching for <a class="xref" href="Discord.Net.HttpException.html#Discord_Net_HttpException_DiscordCode">DiscordCode</a>
|
|
<code>50007</code> when using this method.
|
|
</p>
|
|
</p></div>
|
|
<div class="NOTE"><h5>note</h5><p>
|
|
If you wish to upload an image and have it embedded in a <a class="xref" href="Discord.EmbedType.html#Discord_EmbedType_Rich">Rich</a> embed,
|
|
you may upload the file and refer to the file with "attachment://filename.ext" in the
|
|
<a class="xref" href="Discord.EmbedBuilder.html#Discord_EmbedBuilder_ImageUrl">ImageUrl</a>. See the example section for its usage.
|
|
</p></div>
|
|
</div>
|
|
<h5 id="Discord_UserExtensions_SendFileAsync_Discord_IUser_System_String_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions__examples">Examples</h5>
|
|
<p>The following example uploads a local file called <code>wumpus.txt</code> along with the text
|
|
<code>good discord boi</code> to the channel.</p>
|
|
<pre><code class="lang-cs">await channel.SendFileAsync("wumpus.txt", "good discord boi");</code></pre>
|
|
<p>The following example uploads a local image called <code>b1nzy.jpg</code> embedded inside a rich embed to the
|
|
channel.</p>
|
|
<pre><code class="lang-cs">await channel.SendFileAsync("b1nzy.jpg",
|
|
embed: new EmbedBuilder {ImageUrl = "attachment://b1nzy.jpg"}.Build());</code></pre>
|
|
|
|
<span class="small pull-right mobile-hide">
|
|
<span class="divider">|</span>
|
|
<a href="https://github.com/goaaats/Discord.Net/new/819a325cec923e4a817ab2f08be5c7bbe0d775d0/apiSpec/new?filename=Discord_UserExtensions_SendMessageAsync_Discord_IUser_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions_.md&value=---%0Auid%3A%20Discord.UserExtensions.SendMessageAsync(Discord.IUser%2CSystem.String%2CSystem.Boolean%2CDiscord.Embed%2CDiscord.RequestOptions)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
|
|
</span>
|
|
<span class="small pull-right mobile-hide">
|
|
<a href="https://github.com/goaaats/Discord.Net/blob/819a325cec923e4a817ab2f08be5c7bbe0d775d0/src/Discord.Net.Core/Extensions/UserExtensions.cs/#L34">View Source</a>
|
|
</span>
|
|
<a id="Discord_UserExtensions_SendMessageAsync_" data-uid="Discord.UserExtensions.SendMessageAsync*"></a>
|
|
<h4 id="Discord_UserExtensions_SendMessageAsync_Discord_IUser_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions_" data-uid="Discord.UserExtensions.SendMessageAsync(Discord.IUser,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions)">SendMessageAsync(IUser, String, Boolean, Embed, RequestOptions)</h4>
|
|
<div class="markdown level1 summary"><p>Sends a message via DM.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
<h5 class="decalaration">Declaration</h5>
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static Task<IUserMessage> SendMessageAsync(this IUser user, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)</code></pre>
|
|
</div>
|
|
<h5 class="parameters">Parameters</h5>
|
|
<table class="table table-bordered table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Name</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.IUser.html">IUser</a></td>
|
|
<td><span class="parametername">user</span></td>
|
|
<td><p>The user to send the DM to.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.String</span></td>
|
|
<td><span class="parametername">text</span></td>
|
|
<td><p>The message to be sent.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="xref">System.Boolean</span></td>
|
|
<td><span class="parametername">isTTS</span></td>
|
|
<td><p>Whether the message should be read aloud by Discord or not.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.Embed.html">Embed</a></td>
|
|
<td><span class="parametername">embed</span></td>
|
|
<td><p>The <a class="xref" href="Discord.EmbedType.html#Discord_EmbedType_Rich">Rich</a> <a class="xref" href="Discord.Embed.html">Embed</a> to be sent.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a class="xref" href="Discord.RequestOptions.html">RequestOptions</a></td>
|
|
<td><span class="parametername">options</span></td>
|
|
<td><p>The options to be used when sending the request.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h5 class="returns">Returns</h5>
|
|
<table class="table table-bordered table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><span class="xref">System.Threading.Tasks.Task</span><<a class="xref" href="Discord.IUserMessage.html">IUserMessage</a>></td>
|
|
<td><p>A task that represents the asynchronous send operation. The task result contains the sent message.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h5 id="Discord_UserExtensions_SendMessageAsync_Discord_IUser_System_String_System_Boolean_Discord_Embed_Discord_RequestOptions__remarks">Remarks</h5>
|
|
<div class="markdown level1 remarks"><p>This method attempts to send a direct-message to the user.</p>
|
|
<div class="WARNING"><h5>warning</h5><p>
|
|
<p>
|
|
Please note that this method <strong>will</strong> throw an <a class="xref" href="Discord.Net.HttpException.html">HttpException</a>
|
|
if the user cannot receive DMs due to privacy reasons or if the user has the sender blocked.
|
|
</p>
|
|
<p>
|
|
You may want to consider catching for <a class="xref" href="Discord.Net.HttpException.html#Discord_Net_HttpException_DiscordCode">DiscordCode</a>
|
|
<code>50007</code> when using this method.
|
|
</p>
|
|
</p></div>
|
|
</div>
|
|
</article>
|
|
</div>
|
|
|
|
<div class="hidden-sm col-md-2" role="complementary">
|
|
<div class="sideaffix">
|
|
<div class="contribution">
|
|
<ul class="nav">
|
|
<li>
|
|
<a href="https://github.com/goaaats/Discord.Net/new/819a325cec923e4a817ab2f08be5c7bbe0d775d0/apiSpec/new?filename=Discord_UserExtensions.md&value=---%0Auid%3A%20Discord.UserExtensions%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
|
|
</li>
|
|
<li>
|
|
<a href="https://github.com/goaaats/Discord.Net/blob/819a325cec923e4a817ab2f08be5c7bbe0d775d0/src/Discord.Net.Core/Extensions/UserExtensions.cs/#L8" class="contribution-link">View Source</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
|
|
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<footer>
|
|
<div class="grad-bottom"></div>
|
|
<div class="footer">
|
|
<div class="container">
|
|
<span class="pull-right">
|
|
<a href="#top">Back to top</a>
|
|
</span>
|
|
|
|
<span>Generated by <strong>DocFX</strong></span>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
|
|
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
|
|
<script type="text/javascript" src="../styles/docfx.js"></script>
|
|
<script type="text/javascript" src="../styles/main.js"></script>
|
|
</body>
|
|
</html>
|