IW4M-Admin/SharedLibraryCore/Helpers/MessageToken.cs

25 lines
553 B
C#
Raw Normal View History

using System;
using System.Threading.Tasks;
2018-04-08 02:44:42 -04:00
namespace SharedLibraryCore.Helpers
{
public class MessageToken
{
2019-02-19 20:39:09 -05:00
private readonly Func<Server, Task<string>> _asyncValue;
2019-02-19 20:39:09 -05:00
public MessageToken(string Name, Func<Server, Task<string>> Value)
{
this.Name = Name;
_asyncValue = Value;
}
2022-01-26 11:32:16 -05:00
public string Name { get; }
2019-02-19 20:39:09 -05:00
public async Task<string> ProcessAsync(Server server)
{
2022-01-26 11:32:16 -05:00
var result = await _asyncValue(server);
2019-02-19 20:39:09 -05:00
return result;
}
}
2022-01-26 11:32:16 -05:00
}