Search Results for

    Show / Hide Table of Contents

    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 Source

    FileAttachment(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.

    | Improve this Doc View Source

    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 Source

    Description

    Gets or sets the description of the file.

    Declaration
    public string Description { readonly get; set; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    FileName

    Gets or sets the filename.

    Declaration
    public string FileName { readonly get; set; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    Stream

    Gets the stream containing the file content.

    Declaration
    public readonly Stream Stream { get; }
    Property Value
    Type Description
    Stream

    Methods

    | Improve this Doc View Source

    Dispose()

    Declaration
    public void Dispose()

    Implements

    IDisposable

    Theme

    • Improve this Doc
    • View Source
    In This Article
    Back to top Discord.Net (c) 2015-2022 3.9.0