Show / Hide Table of Contents

Class RestDMChannel

Represents a REST-based direct-message channel.

Inheritance
System.Object
RestEntity<System.UInt64>
RestChannel
RestDMChannel
Implements
IUpdateable
IDMChannel
IRestPrivateChannel
IPrivateChannel
IRestMessageChannel
IMessageChannel
IChannel
ISnowflakeEntity
IEntity<System.UInt64>
Inherited Members
RestChannel.CreatedAt
RestEntity<UInt64>.Id
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Discord.Rest
Assembly: Discord.Net.Rest.dll
Syntax
public class RestDMChannel : RestChannel, IUpdateable, IDMChannel, IRestPrivateChannel, IPrivateChannel, IRestMessageChannel, IMessageChannel, IChannel, ISnowflakeEntity, IEntity<ulong>

Properties

| Improve this Doc View Source

CurrentUser

Gets the current logged-in user.

Declaration
public RestUser CurrentUser { get; }
Property Value
Type Description
RestUser
| Improve this Doc View Source

Recipient

Gets the recipient of the channel.

Declaration
public RestUser Recipient { get; }
Property Value
Type Description
RestUser
| Improve this Doc View Source

Users

Gets a collection that is the current logged-in user and the recipient.

Declaration
public IReadOnlyCollection<RestUser> Users { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyCollection<RestUser>

Methods

| Improve this Doc View Source

CloseAsync(RequestOptions)

Declaration
public Task CloseAsync(RequestOptions options = null)
Parameters
Type Name Description
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

DeleteMessageAsync(IMessage, RequestOptions)

Declaration
public Task DeleteMessageAsync(IMessage message, RequestOptions options = null)
Parameters
Type Name Description
IMessage message
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

DeleteMessageAsync(UInt64, RequestOptions)

Declaration
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
Parameters
Type Name Description
System.UInt64 messageId
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

EnterTypingState(RequestOptions)

Declaration
public IDisposable EnterTypingState(RequestOptions options = null)
Parameters
Type Name Description
RequestOptions options
Returns
Type Description
System.IDisposable
| Improve this Doc View Source

GetMessageAsync(UInt64, RequestOptions)

Declaration
public Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null)
Parameters
Type Name Description
System.UInt64 id
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task<RestMessage>
| Improve this Doc View Source

GetMessagesAsync(IMessage, Direction, Int32, RequestOptions)

Declaration
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = 100, RequestOptions options = null)
Parameters
Type Name Description
IMessage fromMessage
Direction dir
System.Int32 limit
RequestOptions options
Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<RestMessage>>
| Improve this Doc View Source

GetMessagesAsync(Int32, RequestOptions)

Declaration
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = 100, RequestOptions options = null)
Parameters
Type Name Description
System.Int32 limit
RequestOptions options
Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<RestMessage>>
| Improve this Doc View Source

GetMessagesAsync(UInt64, Direction, Int32, RequestOptions)

Declaration
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = 100, RequestOptions options = null)
Parameters
Type Name Description
System.UInt64 fromMessageId
Direction dir
System.Int32 limit
RequestOptions options
Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<RestMessage>>
| Improve this Doc View Source

GetPinnedMessagesAsync(RequestOptions)

Declaration
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
Parameters
Type Name Description
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<RestMessage>>
| Improve this Doc View Source

GetUser(UInt64)

Gets a user in this channel from the provided id.

Declaration
public RestUser GetUser(ulong id)
Parameters
Type Name Description
System.UInt64 id

The snowflake identifier of the user.

Returns
Type Description
RestUser

A RestUser object that is a recipient of this channel; otherwise null.

| Improve this Doc View Source

SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean)

Declaration
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)
Parameters
Type Name Description
System.IO.Stream stream
System.String filename
System.String text
System.Boolean isTTS
Embed embed
RequestOptions options
System.Boolean isSpoiler
Returns
Type Description
System.Threading.Tasks.Task<RestUserMessage>
Exceptions
Type Condition
System.ArgumentOutOfRangeException

Message content is too long, length must be less or equal to MaxMessageSize.

| Improve this Doc View Source

SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean)

Declaration
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)
Parameters
Type Name Description
System.String filePath
System.String text
System.Boolean isTTS
Embed embed
RequestOptions options
System.Boolean isSpoiler
Returns
Type Description
System.Threading.Tasks.Task<RestUserMessage>
Exceptions
Type Condition
System.ArgumentException

filePath is a zero-length string, contains only white space, or contains one or more invalid characters as defined by System.IO.Path.GetInvalidPathChars.

System.ArgumentNullException

filePath is null.

System.IO.PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.

System.IO.DirectoryNotFoundException

The specified path is invalid, (for example, it is on an unmapped drive).

System.UnauthorizedAccessException

filePath specified a directory.-or- The caller does not have the required permission.

System.IO.FileNotFoundException

The file specified in filePath was not found.

System.NotSupportedException

filePath is in an invalid format.

System.IO.IOException

An I/O error occurred while opening the file.

System.ArgumentOutOfRangeException

Message content is too long, length must be less or equal to MaxMessageSize.

| Improve this Doc View Source

SendMessageAsync(String, Boolean, Embed, RequestOptions)

Declaration
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)
Parameters
Type Name Description
System.String text
System.Boolean isTTS
Embed embed
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task<RestUserMessage>
Exceptions
Type Condition
System.ArgumentOutOfRangeException

Message content is too long, length must be less or equal to MaxMessageSize.

| Improve this Doc View Source

ToString()

Gets a string that represents the Username#Discriminator of the recipient.

Declaration
public override string ToString()
Returns
Type Description
System.String

A string that resolves to the Recipient of this channel.

Overrides
System.Object.ToString()
| Improve this Doc View Source

TriggerTypingAsync(RequestOptions)

Declaration
public Task TriggerTypingAsync(RequestOptions options = null)
Parameters
Type Name Description
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

UpdateAsync(RequestOptions)

Declaration
public override Task UpdateAsync(RequestOptions options = null)
Parameters
Type Name Description
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task
Overrides
RestChannel.UpdateAsync(RequestOptions)

Explicit Interface Implementations

| Improve this Doc View Source

IChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)

Declaration
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
Type Name Description
System.UInt64 id
CacheMode mode
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task<IUser>
| Improve this Doc View Source

IChannel.GetUsersAsync(CacheMode, RequestOptions)

Declaration
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
Parameters
Type Name Description
CacheMode mode
RequestOptions options
Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IUser>>
| Improve this Doc View Source

IChannel.Name

Declaration
string IChannel.Name { get; }
Returns
Type Description
System.String
| Improve this Doc View Source

IDMChannel.Recipient

Declaration
IUser IDMChannel.Recipient { get; }
Returns
Type Description
IUser
| Improve this Doc View Source

IMessageChannel.GetMessageAsync(UInt64, CacheMode, RequestOptions)

Declaration
Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
Type Name Description
System.UInt64 id
CacheMode mode
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task<IMessage>
| Improve this Doc View Source

IMessageChannel.GetMessagesAsync(IMessage, Direction, Int32, CacheMode, RequestOptions)

Declaration
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode, RequestOptions options)
Parameters
Type Name Description
IMessage fromMessage
Direction dir
System.Int32 limit
CacheMode mode
RequestOptions options
Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IMessage>>
| Improve this Doc View Source

IMessageChannel.GetMessagesAsync(Int32, CacheMode, RequestOptions)

Declaration
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options)
Parameters
Type Name Description
System.Int32 limit
CacheMode mode
RequestOptions options
Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IMessage>>
| Improve this Doc View Source

IMessageChannel.GetMessagesAsync(UInt64, Direction, Int32, CacheMode, RequestOptions)

Declaration
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options)
Parameters
Type Name Description
System.UInt64 fromMessageId
Direction dir
System.Int32 limit
CacheMode mode
RequestOptions options
Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IMessage>>
| Improve this Doc View Source

IMessageChannel.GetPinnedMessagesAsync(RequestOptions)

Declaration
Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
Parameters
Type Name Description
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IMessage>>
| Improve this Doc View Source

IMessageChannel.SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean)

Declaration
Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
Parameters
Type Name Description
System.IO.Stream stream
System.String filename
System.String text
System.Boolean isTTS
Embed embed
RequestOptions options
System.Boolean isSpoiler
Returns
Type Description
System.Threading.Tasks.Task<IUserMessage>
| Improve this Doc View Source

IMessageChannel.SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean)

Declaration
Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
Parameters
Type Name Description
System.String filePath
System.String text
System.Boolean isTTS
Embed embed
RequestOptions options
System.Boolean isSpoiler
Returns
Type Description
System.Threading.Tasks.Task<IUserMessage>
| Improve this Doc View Source

IMessageChannel.SendMessageAsync(String, Boolean, Embed, RequestOptions)

Declaration
Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
Parameters
Type Name Description
System.String text
System.Boolean isTTS
Embed embed
RequestOptions options
Returns
Type Description
System.Threading.Tasks.Task<IUserMessage>
| Improve this Doc View Source

IPrivateChannel.Recipients

Declaration
IReadOnlyCollection<IUser> IPrivateChannel.Recipients { get; }
Returns
Type Description
System.Collections.Generic.IReadOnlyCollection<IUser>
| Improve this Doc View Source

IRestPrivateChannel.Recipients

Declaration
IReadOnlyCollection<RestUser> IRestPrivateChannel.Recipients { get; }
Returns
Type Description
System.Collections.Generic.IReadOnlyCollection<RestUser>

Implements

IUpdateable
IDMChannel
IRestPrivateChannel
IPrivateChannel
IRestMessageChannel
IMessageChannel
IChannel
ISnowflakeEntity
IEntity<TId>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX