示例#1
0
 protected bool Equals(Attachment other)
 {
     return string.Equals(Title, other.Title) && string.Equals(TitleLink, other.TitleLink) && TitleLinkDownloadable == other.TitleLinkDownloadable
            && string.Equals(Text, other.Text) && string.Equals(ImageUrl, other.ImageUrl) && string.Equals(AuthorName, other.AuthorName)
            && string.Equals(AuthorIcon, other.AuthorIcon) && string.Equals(ThumbUrl, other.ThumbUrl) && string.Equals(Color, other.Color)
            && Timestamp.Equals(other.Timestamp);
 }
        public IEnumerable<IMessageResponse> GetResponse(ResponseContext context, RocketChatBot caller)
        {
            var message = context.Message;

            var search = message.Message.Replace(GiphyCommand, "").Trim();
            var url = GetGiphy(search);
            var attachment = new Attachment
            {
                ImageUrl = url
            };
            yield return message.CreateAttachmentReply(attachment);
        }
 public async Task<MethodResult<RocketMessage>> SendCustomMessageAsync(Attachment attachment, string roomId)
 {
     var request = new
     {
         msg = "",
         rid = roomId,
         bot = IsBot,
         attachments = new[]
         {
             attachment
         }
     };
     var result = await _client.CallAsync("sendMessage", TimeoutToken, request).ConfigureAwait(false);
     return result.ToObject<MethodResult<RocketMessage>>(JsonSerializer);
 }
示例#4
0
 public static AttachmentResponse CreateAttachmentReply(this RocketMessage message, Attachment reply)
 {
     return new AttachmentResponse(reply, message.RoomId);
 }
 public AttachmentResponse(Attachment attachment, string roomId)
 {
     Attachment = attachment;
     RoomId = roomId;
 }