mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-07 21:58:06 -05:00
add BroadcastAsync
This commit is contained in:
parent
932bc77798
commit
c4b9f02258
@ -177,7 +177,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
return e;
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[Obsolete("Use TellAsync")]
|
||||
public void Tell(IEnumerable<string> messages)
|
||||
{
|
||||
foreach (var message in messages)
|
||||
@ -188,10 +188,15 @@ namespace SharedLibraryCore.Database.Models
|
||||
}
|
||||
}
|
||||
|
||||
public async Task TellAsync(IEnumerable<string> messages, CancellationToken token =default)
|
||||
public async Task TellAsync(IEnumerable<string> messages, CancellationToken token = default)
|
||||
{
|
||||
foreach (var message in messages)
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await Tell(message).WaitAsync(Utilities.DefaultCommandTimeout, token);
|
||||
}
|
||||
}
|
||||
|
@ -238,6 +238,7 @@ namespace SharedLibraryCore
|
||||
return e;
|
||||
}
|
||||
|
||||
[Obsolete("Use BroadcastAsync")]
|
||||
public void Broadcast(IEnumerable<string> messages, EFClient sender = null)
|
||||
{
|
||||
foreach (var message in messages)
|
||||
@ -248,6 +249,19 @@ namespace SharedLibraryCore
|
||||
}
|
||||
}
|
||||
|
||||
public async Task BroadcastAsync(IEnumerable<string> messages, EFClient sender = null,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
foreach (var message in messages)
|
||||
{
|
||||
if (Manager.CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await Broadcast(message, sender).WaitAsync(Utilities.DefaultCommandTimeout, Manager.CancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a message to a particular players
|
||||
|
Loading…
x
Reference in New Issue
Block a user