Added DeleteMessage, added ChannelId to outgoing messages

This commit is contained in:
Brandon Smith
2015-08-13 13:45:49 -03:00
parent a7455ba60f
commit adf30ad4e5
4 changed files with 21 additions and 14 deletions

View File

@@ -591,7 +591,7 @@ namespace Discord
if (text.Length <= 2000)
{
var msg = await DiscordAPI.SendMessage(channelId, text, mentions, _httpOptions);
_messages.Update(msg.Id, msg);
_messages.Update(msg.Id, channelId, msg);
}
else
{
@@ -606,6 +606,17 @@ namespace Discord
}
}
public Task DeleteMessage(Message msg)
=> DeleteMessage(msg.ChannelId, msg.Id);
public async Task DeleteMessage(string channelId, string msgId)
{
try
{
await DiscordAPI.DeleteMessage(channelId, msgId, _httpOptions);
}
catch (WebException ex) when ((ex.Response as HttpWebResponse)?.StatusCode == HttpStatusCode.NotFound) { }
}
//Voice
public Task Mute(Server server, User user)
=> Mute(server.Id, user.Id);