DSharpPlus/Entities/DiscordWebhookBuilder.cs
/// <summary>
/// Sets if the message has files to be sent.
/// </summary>
/// <param name="stream">The Stream to the file.</param>
/// <param name="resetStreamPosition">Tells the API Client to reset the stream position to what it was after the file is sent.</param>
/// <returns></returns>
Sets if the message has files to be sent.
Sets if the message has files to be sent .
public DiscordWebhookBuilder AddFile(FileStream stream, bool resetStreamPosition = false)
        {
            if (this.Files.Count() >= 10)
                throw new ArgumentException("Cannot send more than 10 files with a single message.");
            if (this._files.Any(x => x.FileName == stream.Name))
                throw new ArgumentException("A File with that filename already exists");
            if (resetStreamPosition)
                this._files.Add(new DiscordMessageFile(stream.Name, stream, stream.Position));
            else
                this._files.Add(new DiscordMessageFile(stream.Name, stream, null));
            return this;
        }
public DiscordWebhookBuilder AddFile ( FileStream stream , bool resetStreamPosition = false ) { if ( this . Files . Count ( ) >= 10 ) throw new ArgumentException ( " " ) ; if ( this . _files . Any ( x => x . FileName == stream . Name ) ) throw new ArgumentException ( " " ) ; if ( resetStreamPosition ) this . _files . Add ( new DiscordMessageFile ( stream . Name , stream , stream . Position ) ) ; else this . _files . Add ( new DiscordMessageFile ( stream . Name , stream , null ) ) ; return this ; }
Sets if the message has files to be sent.
Sets if the message has files to be sent .
None
stream
FileStream
The Stream to the file.
The Stream to the file .
resetStreamPosition
bool
Tells the API Client to reset the stream position to what it was after the file is sent.
Tells the API Client to reset the stream position to what it was after the file is sent .