@@ -19,6 +19,7 @@ | |||||
public static string ChannelMessages(string channelId) => $"channels/{channelId}/messages"; | public static string ChannelMessages(string channelId) => $"channels/{channelId}/messages"; | ||||
public static string ChannelMessages(string channelId, int limit) => $"channels/{channelId}/messages?limit={limit}"; | public static string ChannelMessages(string channelId, int limit) => $"channels/{channelId}/messages?limit={limit}"; | ||||
public static string ChannelMessage(string channelId, string msgId) => $"channels/{channelId}/messages/{msgId}"; | public static string ChannelMessage(string channelId, string msgId) => $"channels/{channelId}/messages/{msgId}"; | ||||
public static string ChannelMessageAck(string channelId, string msgId) => $"channels/{channelId}/messages/{msgId}/ack"; | |||||
public static string ChannelInvites(string channelId) => $"channels/{channelId}/invites"; | public static string ChannelInvites(string channelId) => $"channels/{channelId}/invites"; | ||||
public static string ChannelPermission(string channelId, string userOrRoleId) => $"channels/{channelId}/permissions/{userOrRoleId}"; | public static string ChannelPermission(string channelId, string userOrRoleId) => $"channels/{channelId}/permissions/{userOrRoleId}"; | ||||
@@ -44,7 +45,6 @@ | |||||
public const string VoiceIce = "voice/ice"; | public const string VoiceIce = "voice/ice"; | ||||
public const string StatusActiveMaintenance = "scheduled-maintenances/active.json"; | public const string StatusActiveMaintenance = "scheduled-maintenances/active.json"; | ||||
public const string StatusUnresolvedMaintenance = "scheduled-maintenances/unresolved.json"; | |||||
public const string StatusUpcomingMaintenance = "scheduled-maintenances/upcoming.json"; | public const string StatusUpcomingMaintenance = "scheduled-maintenances/upcoming.json"; | ||||
} | } | ||||
} | } |
@@ -105,10 +105,6 @@ namespace Discord | |||||
} | } | ||||
//Incidents | //Incidents | ||||
public Task<GetIncidentsResponse> GetUnresolvedIncidents() | |||||
{ | |||||
return _rest.Get<GetIncidentsResponse>(Endpoints.StatusUnresolvedMaintenance); | |||||
} | |||||
public Task<GetIncidentsResponse> GetActiveIncidents() | public Task<GetIncidentsResponse> GetActiveIncidents() | ||||
{ | { | ||||
return _rest.Get<GetIncidentsResponse>(Endpoints.StatusActiveMaintenance); | return _rest.Get<GetIncidentsResponse>(Endpoints.StatusActiveMaintenance); | ||||
@@ -207,7 +203,14 @@ namespace Discord | |||||
var request = new EditMessageRequest { Content = message, Mentions = mentions }; | var request = new EditMessageRequest { Content = message, Mentions = mentions }; | ||||
return _rest.Patch<EditMessageResponse>(Endpoints.ChannelMessage(channelId, messageId), request); | return _rest.Patch<EditMessageResponse>(Endpoints.ChannelMessage(channelId, messageId), request); | ||||
} | } | ||||
public Task SendIsTyping(string channelId) | |||||
public Task AckMessage(string messageId, string channelId) | |||||
{ | |||||
if (messageId == null) throw new ArgumentNullException(nameof(messageId)); | |||||
if (channelId == null) throw new ArgumentNullException(nameof(channelId)); | |||||
return _rest.Post(Endpoints.ChannelMessageAck(channelId, messageId)); | |||||
} | |||||
public Task SendIsTyping(string channelId) | |||||
{ | { | ||||
if (channelId == null) throw new ArgumentNullException(nameof(channelId)); | if (channelId == null) throw new ArgumentNullException(nameof(channelId)); | ||||
@@ -534,15 +534,17 @@ namespace Discord | |||||
var data = e.Payload.ToObject<MessageCreateEvent>(_serializer); | var data = e.Payload.ToObject<MessageCreateEvent>(_serializer); | ||||
Message msg = null; | Message msg = null; | ||||
bool wasLocal = _config.UseMessageQueue && data.Author.Id == CurrentUserId && data.Nonce != null; | |||||
if (wasLocal) | |||||
bool isAuthor = data.Author.Id == CurrentUserId; | |||||
bool hasFinishedSending = false; | |||||
if (_config.UseMessageQueue && isAuthor && data.Nonce != null) | |||||
{ | { | ||||
msg = _messages.Remap("nonce" + data.Nonce, data.Id); | msg = _messages.Remap("nonce" + data.Nonce, data.Id); | ||||
if (msg != null) | if (msg != null) | ||||
{ | { | ||||
msg.IsQueued = false; | msg.IsQueued = false; | ||||
msg.Id = data.Id; | msg.Id = data.Id; | ||||
} | |||||
hasFinishedSending = true; | |||||
} | |||||
} | } | ||||
if (msg == null) | if (msg == null) | ||||
@@ -564,7 +566,11 @@ namespace Discord | |||||
member.UpdateActivity(data.Timestamp); | member.UpdateActivity(data.Timestamp); | ||||
} | } | ||||
} | } | ||||
if (wasLocal) | |||||
if (_config.AckMessages && isAuthor) | |||||
await _api.AckMessage(data.Id, data.ChannelId); | |||||
if (hasFinishedSending) | |||||
RaiseMessageSent(msg); | RaiseMessageSent(msg); | ||||
RaiseMessageCreated(msg); | RaiseMessageCreated(msg); | ||||
} | } | ||||
@@ -63,6 +63,9 @@ namespace Discord | |||||
/// <summary> (Experimental) Maintains the LastActivity property for users, showing when they last made an action (sent message, joined server, typed, etc). </summary> | /// <summary> (Experimental) Maintains the LastActivity property for users, showing when they last made an action (sent message, joined server, typed, etc). </summary> | ||||
public bool TrackActivity { get { return _trackActivity; } set { SetValue(ref _trackActivity, value); } } | public bool TrackActivity { get { return _trackActivity; } set { SetValue(ref _trackActivity, value); } } | ||||
private bool _trackActivity = true; | private bool _trackActivity = true; | ||||
/// <summary> (Experimental) Acknowledges all incoming messages so that they appear read. </summary> | |||||
public bool AckMessages { get { return _ackMessages; } set { SetValue(ref _ackMessages, value); } } | |||||
private bool _ackMessages = false; | |||||
//Internals | //Internals | ||||
internal bool VoiceOnly { get { return _voiceOnly; } set { SetValue(ref _voiceOnly, value); } } | internal bool VoiceOnly { get { return _voiceOnly; } set { SetValue(ref _voiceOnly, value); } } | ||||