public async Task FreddysaysAsync(ISocketMessageChannel channel, params string[] message) { string msg = String.Join(" ", message); await channel.TriggerTypingAsync(); Thread.Sleep(2000); await channel.SendMessageAsync(msg, false, null, null); }
public static async Task <RestUserMessage> SendMessage(SocketCommandContext context, string content = null, Embed embed = null, ISocketMessageChannel Channel = null) { if (Channel == null) { Channel = context.Channel; } await Channel.TriggerTypingAsync(); return(await Channel.SendMessageAsync(text : content, embed : embed)); }
private static async Task SendLogToChannelAsync(ISocketMessageChannel channel, string id) { var file = Path.Combine("Logs", id + ".txt"); if (!File.Exists(file)) { file = Path.Combine("Logs", "Archive", id + ".txt"); } if (!File.Exists(file)) { file = Path.Combine("Logs", "Failed", id + ".txt"); } if (File.Exists(file)) { await channel.TriggerTypingAsync(); try { await DecksiteApi.UploadLogAsync(int.Parse(id)); await channel.SendMessageAsync($"https://logs.pennydreadfulmagic.com/match/{id}/"); } catch (Exception e) { var contents = File.ReadAllLines(file); var caption = $"Format={contents[0]}, Comment=\"{contents[1]}\", Players=[{contents[3]}]"; await channel.SendFileAsync(file, caption); Console.WriteLine($"Couldn't upload to logsite, {e}"); } } else { await channel.TriggerTypingAsync(); await channel.SendMessageAsync($"Could not find log for MatchID {id}"); } }