Struct FileAttachment
Represents an outgoing file attachment used to send a file to discord.
Implements
IDisposable
Namespace: Discord
Assembly: Discord.Net.Core.dll
Syntax
public struct FileAttachment : IDisposable
Constructors
| Improve this Doc View SourceFileAttachment(Stream, String, String, Boolean)
Creates a file attachment from a stream.
Declaration
public FileAttachment(Stream stream, string fileName, string description = null, bool isSpoiler = false)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream to create the attachment from. |
String | fileName | The name of the attachment. |
String | description | The description of the attachment. |
Boolean | isSpoiler | Whether or not the attachment is a spoiler. |
FileAttachment(String, String, String, Boolean)
Create the file attachment from a file path.
Declaration
public FileAttachment(string path, string fileName = null, string description = null, bool isSpoiler = false)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path to the file. |
String | fileName | The name of the attachment. |
String | description | The description of the attachment. |
Boolean | isSpoiler | Whether or not the attachment is a spoiler. |
Remarks
This file path is NOT validated and is passed directly into a
Properties
| Improve this Doc View SourceDescription
Gets or sets the description of the file.
Declaration
public string Description { readonly get; set; }
Property Value
Type | Description |
---|---|
String |
FileName
Gets or sets the filename.
Declaration
public string FileName { readonly get; set; }
Property Value
Type | Description |
---|---|
String |
IsSpoiler
Gets or sets whether this file should be marked as a spoiler.
Declaration
public bool IsSpoiler { readonly get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Stream
Gets the stream containing the file content.
Declaration
public readonly Stream Stream { get; }
Property Value
Type | Description |
---|---|
Stream |
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
Implements
IDisposable