public Task <IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null) { if (embed != null) { text += $"\n{embed.Title} \n{embed.Description} \n{embed.Fields.Select(x => $"{x.Name} {x.Value}").Combine("\n")}"; } if (string.IsNullOrWhiteSpace(text)) { return(Task.FromResult(default(IUserMessage))); } if (text.Length >= 280) { text = text.Substring(0, 279); } text = new string((from c in text where c == ' ' || c == '\n' || (c >= '!' && c <= 'z') select c).ToArray()); var res = TweetSharpWrapper.SendReply(service, thread.First(), text); if (res != null && res.Item1 != null && res.Item2.StatusCode == HttpStatusCode.OK) { thread.Insert(0, res.Item1); } else { this.SendMessageAsync($"That didn't work :c\nTwitter said: {res.Item2.Error}").Wait(); } return(Task.FromResult(default(IUserMessage))); }
public Task <IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false) { var res = TweetSharpWrapper.SendReplyImage(service, thread.First(), string.IsNullOrWhiteSpace(text) ? "here's ya image 😊" : text, stream, filename); if (res != null && res.Item1 != null && res.Item2.StatusCode == HttpStatusCode.OK) { thread.Insert(0, res.Item1); } else { this.SendMessageAsync($"That didn't work :c\n{res.Item2.Error}").Wait(); } return(Task.FromResult(default(IUserMessage))); }