public async Task <IDiscordMessage> SendMessage(string message) { IDMChannel c = await user.CreateDMChannelAsync(); RuntimeMessage m = new RuntimeMessage(await c.SendMessageAsync(message)); Log.Message("Sent message to " + user.Username); return(m); }
public async Task <IDiscordMessage> SendMessage(string message) { try { RuntimeMessage m = new RuntimeMessage(await(channel as IMessageChannel).SendMessage(message)); Log.Message("Sent message to channel " + channel.Name); return(m); } catch { Log.ErrorAt("SendMessage", "failed to send"); } return(null); }
public async Task <IDiscordMessage> SendMessage(string message) { RuntimeMessage m = null; MeruUtils.TryAsync(async() => { m = new RuntimeMessage(await(channel as IMessageChannel).SendMessage(message)); Log.Message("Sent message to channel " + channel.Name); }, async(ex) => { Log.ErrorAt("SendMessage", "failed to send"); }); return(m); }
public async Task <IDiscordMessage> SendMessage(IDiscordEmbed embed) { RuntimeMessage m = null; try { Log.Message("Sent embed to channel " + channel.Name); m = new RuntimeMessage( await(channel as IMessageChannel) .SendMessageAsync("", false, (embed as IProxy <EmbedBuilder>) .ToNativeObject())); } catch (Exception ex) { Log.ErrorAt("SendMessage", ex.Message); } return(m); }
public async Task <IDiscordMessage> SendMessage(IDiscordEmbed embed) { RuntimeMessage m = null; await MeruUtils.TryAsync(async() => { Log.Message("Sent embed to channel " + channel.Name); m = new RuntimeMessage( await(channel as IMessageChannel) .SendMessageAsync("", false, (embed as IProxy <EmbedBuilder>) .ToNativeObject())); }, async (ex) => { Log.ErrorAt("SendMessage", ex.Message); }); return(m); }