Renamed DiscordClient.Run to DiscordClient.ExecuteAndWait. Added Run to Legacy.
This commit is contained in:
@@ -1040,8 +1040,8 @@ namespace Discord
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Async Wrapper
|
#region Async Wrapper
|
||||||
/// <summary> Blocking call that will not return until client has been stopped. This is mainly intended for use in console applications. </summary>
|
/// <summary> Blocking call that will execute the provided async method and wait until client has been manually stopped. This is mainly intended for use in console applications. </summary>
|
||||||
public void Run(Func<Task> asyncAction)
|
public void ExecuteAndWait(Func<Task> asyncAction)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1050,7 +1050,7 @@ namespace Discord
|
|||||||
catch (TaskCanceledException) { }
|
catch (TaskCanceledException) { }
|
||||||
_disconnectedEvent.WaitOne();
|
_disconnectedEvent.WaitOne();
|
||||||
}
|
}
|
||||||
/// <summary> Blocking call that will not return until client has been stopped. This is mainly intended for use in console applications. </summary>
|
/// <summary> Blocking call and wait until client has been manually stopped. This is mainly intended for use in console applications. </summary>
|
||||||
public void Wait()
|
public void Wait()
|
||||||
{
|
{
|
||||||
_disconnectedEvent.WaitOne();
|
_disconnectedEvent.WaitOne();
|
||||||
|
|||||||
@@ -25,6 +25,17 @@ namespace Discord.Legacy
|
|||||||
|
|
||||||
public static class LegacyExtensions
|
public static class LegacyExtensions
|
||||||
{
|
{
|
||||||
|
[Obsolete("Use DiscordClient.ExecuteAndWait")]
|
||||||
|
public static void Run(this DiscordClient client, Func<Task> asyncAction)
|
||||||
|
{
|
||||||
|
client.ExecuteAndWait(asyncAction);
|
||||||
|
}
|
||||||
|
[Obsolete("Use DiscordClient.Wait")]
|
||||||
|
public static void Run(this DiscordClient client)
|
||||||
|
{
|
||||||
|
client.Wait();
|
||||||
|
}
|
||||||
|
|
||||||
[Obsolete("Use Server.FindChannels")]
|
[Obsolete("Use Server.FindChannels")]
|
||||||
public static IEnumerable<Channel> FindChannels(this DiscordClient client, Server server, string name, ChannelType type = null, bool exactMatch = false)
|
public static IEnumerable<Channel> FindChannels(this DiscordClient client, Server server, string name, ChannelType type = null, bool exactMatch = false)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user