DSharpPlus/Entities/Webhook/DiscordWebhookBuilder.cs
/// <summary>
/// Adds a file to send at the execution of the webhook.
/// </summary>
/// <param name="filename">Name of the file.</param>
/// <param name="data">File data.</param>
/// <param name="resetStreamPosition">Tells the API Client to reset the stream position to what it was after the file is sent.</param>
Adds a file to send at the execution of the webhook.
Adds a file to send at the execution of the webhook .
public DiscordWebhookBuilder AddFile(string filename, Stream data, 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 == filename))
                throw new ArgumentException("A File with that filename already exists");
            if (resetStreamPosition)
                this._files.Add(new DiscordMessageFile(filename, data, data.Position));
            else
                this._files.Add(new DiscordMessageFile(filename, data, null));
            return this;
        }
public DiscordWebhookBuilder AddFile ( string filename , Stream data , bool resetStreamPosition = false ) { if ( this . Files . Count ( ) >= 10 ) throw new ArgumentException ( " " ) ; if ( this . _files . Any ( x => x . FileName == filename ) ) throw new ArgumentException ( " " ) ; if ( resetStreamPosition ) this . _files . Add ( new DiscordMessageFile ( filename , data , data . Position ) ) ; else this . _files . Add ( new DiscordMessageFile ( filename , data , null ) ) ; return this ; }
Adds a file to send at the execution of the webhook.
Adds a file to send at the execution of the webhook .
filename
string
Name of the file.
Name of the file .
data
Stream
None
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 .