DeukBot4/DeukBot4/MessageHandlers/CommandHandler/RequestStructure/RequestParameter.cs

37 lines
744 B
C#

using System;
namespace DeukBot4.MessageHandlers.CommandHandler.RequestStructure
{
public class RequestParameter
{
private readonly string _value;
public RequestParameter(string value)
{
_value = value;
}
public int AsInt()
{
if (int.TryParse(_value, out var i))
{
return i;
}
throw new ArgumentException();
}
public string AsString()
{
return _value;
}
public ulong AsUlong()
{
if (ulong.TryParse(_value, out var i))
{
return i;
}
throw new ArgumentException();
}
}
}