Allow attaching embeds alongside a file upload. (#978)
commit a8bafb90cd1c5ea12abaa1aa01d0929833c999a8 Merge: f38dd4c4 7e04285e Author: WamWooWam <wamwoowam@gmail.com> Date: Mon Mar 12 08:05:52 2018 +0000 Merge branch 'dev' of https://github.com/WamWooWam/Discord.Net into dev commit f38dd4c42149380f3f7f86c21c86cb76d0f104b7 Author: WamWooWam <wamwoowam@gmail.com> Date: Mon Mar 12 08:05:49 2018 +0000 Cleaned up & fixed code style. commit 7e04285e5dcc0102c9b958e75155834ca35724b9 Author: Thomas May <wamwoowam@gmail.com> Date: Sun Mar 11 14:11:28 2018 +0000 Revert changes to DefaultRestClient Didn't actually need to change this, whoops. commit 3f5b2c8ef16d356e7b9588c4b36af03162ab7089 Author: WamWooWam <wamwoowam@gmail.com> Date: Sat Mar 10 19:30:44 2018 +0000 Enabled embeds alongside uploaded files. God damn Discord is a mess. Co-authored-by: WamWooWam <wamwoowam@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,10 +11,10 @@ namespace Discord
|
||||
Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null);
|
||||
#if FILESYSTEM
|
||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary>
|
||||
Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, RequestOptions options = null);
|
||||
Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null);
|
||||
#endif
|
||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary>
|
||||
Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, RequestOptions options = null);
|
||||
Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null);
|
||||
|
||||
/// <summary> Gets a message from this message channel with the given id, or null if not found. </summary>
|
||||
Task<IMessage> GetMessageAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace Discord
|
||||
@@ -8,10 +8,10 @@ namespace Discord
|
||||
/// <summary>
|
||||
/// Sends a message to the user via DM.
|
||||
/// </summary>
|
||||
public static async Task<IUserMessage> SendMessageAsync(this IUser user,
|
||||
string text,
|
||||
public static async Task<IUserMessage> SendMessageAsync(this IUser user,
|
||||
string text,
|
||||
bool isTTS = false,
|
||||
Embed embed = null,
|
||||
Embed embed = null,
|
||||
RequestOptions options = null)
|
||||
{
|
||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
|
||||
@@ -25,23 +25,25 @@ namespace Discord
|
||||
string filename,
|
||||
string text = null,
|
||||
bool isTTS = false,
|
||||
Embed embed = null,
|
||||
RequestOptions options = null
|
||||
)
|
||||
{
|
||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
|
||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
#if FILESYSTEM
|
||||
/// <summary>
|
||||
/// Sends a file to the user via DM.
|
||||
/// </summary>
|
||||
public static async Task<IUserMessage> SendFileAsync(this IUser user,
|
||||
string filePath,
|
||||
string text = null,
|
||||
bool isTTS = false,
|
||||
public static async Task<IUserMessage> SendFileAsync(this IUser user,
|
||||
string filePath,
|
||||
string text = null,
|
||||
bool isTTS = false,
|
||||
Embed embed = null,
|
||||
RequestOptions options = null)
|
||||
{
|
||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false);
|
||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user