Added DiscordConfig.Mode
This commit is contained in:
@@ -5,6 +5,13 @@ using System.Text;
|
|||||||
|
|
||||||
namespace Discord
|
namespace Discord
|
||||||
{
|
{
|
||||||
|
public enum DiscordMode
|
||||||
|
{
|
||||||
|
/// <summary> Enable bot-only functions. Use this mode if you are creating a bot, automated application, or interface. </summary>
|
||||||
|
Bot = 0,
|
||||||
|
/// <summary> Enables client-only functions. Use this mode if you are creating a custom client. </summary>
|
||||||
|
Client
|
||||||
|
}
|
||||||
public enum LogSeverity : byte
|
public enum LogSeverity : byte
|
||||||
{
|
{
|
||||||
Error = 1,
|
Error = 1,
|
||||||
@@ -45,11 +52,13 @@ namespace Discord
|
|||||||
/// <summary> Enables or disables the default event logger. </summary>
|
/// <summary> Enables or disables the default event logger. </summary>
|
||||||
public bool LogEvents { get { return _logEvents; } set { SetValue(ref _logEvents, value); } }
|
public bool LogEvents { get { return _logEvents; } set { SetValue(ref _logEvents, value); } }
|
||||||
private bool _logEvents = true;
|
private bool _logEvents = true;
|
||||||
|
/// <summary> Specifies the mode that this application should run in. </summary>
|
||||||
|
public DiscordMode Mode { get { return _mode; } set { SetValue(ref _mode, value); } }
|
||||||
|
private DiscordMode _mode = DiscordMode.Bot;
|
||||||
|
|
||||||
/// <summary> User Agent string to use when connecting to Discord. </summary>
|
/// <summary> User Agent string to use when connecting to Discord. </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string UserAgent { get { return _userAgent; } }
|
public string UserAgent { get; private set; }
|
||||||
private string _userAgent;
|
|
||||||
|
|
||||||
//Rest
|
//Rest
|
||||||
|
|
||||||
@@ -120,7 +129,7 @@ namespace Discord
|
|||||||
builder.Append(' ');
|
builder.Append(' ');
|
||||||
}
|
}
|
||||||
builder.Append($"DiscordBot ({LibUrl}, v{LibVersion})");
|
builder.Append($"DiscordBot ({LibUrl}, v{LibVersion})");
|
||||||
_userAgent = builder.ToString();
|
UserAgent = builder.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,6 +340,9 @@ namespace Discord
|
|||||||
|
|
||||||
public Task Acknowledge()
|
public Task Acknowledge()
|
||||||
{
|
{
|
||||||
|
if (Client.Config.Mode != DiscordMode.Client)
|
||||||
|
throw new InvalidOperationException("Message.Acknowledge may only be used in Client mode.");
|
||||||
|
|
||||||
if (User.Id != Client.CurrentUser.Id)
|
if (User.Id != Client.CurrentUser.Id)
|
||||||
return Client.ClientAPI.Send(new AckMessageRequest(Channel.Id, Id));
|
return Client.ClientAPI.Send(new AckMessageRequest(Channel.Id, Id));
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user