function wrapEntity (content, entity) {
  switch (entity.type) {
    case 'bold':
      return `<b>${content}</b>`
    case 'italic':
      return `<i>${content}</i>`
    case 'code':
      return `<code>${content}</code>`
    case 'pre':
      return `<pre>${content}</pre>`
    case 'text_link':
      return `<a href="${entity.url}">${content}</a>`
    default:
      return content
  }
}

function applyEntity (text, entity) {
  const head = text.substring(0, entity.offset)
  const tail = text.substring(entity.offset + entity.length)
  const content = wrapEntity(text.substring(entity.offset, entity.offset + entity.length), entity)
  return `${head}${content}${tail}`
}

module.exports = {
  copyMethods: {
    audio: 'sendAudio',
    contact: 'sendContact',
    document: 'sendDocument',
    location: 'sendLocation',
    photo: 'sendPhoto',
    sticker: 'sendSticker',
    text: 'sendMessage',
    venue: 'sendVenue',
    video: 'sendVideo',
    video_note: 'sendVideoNote',
    animation: 'sendAnimation',
    voice: 'sendVoice'
  },
  text: (message) => {
    const entities = message.entities || []
    return {
      parse_mode: entities.length > 0 ? 'HTML' : '',
      text: entities.reduceRight(applyEntity, message.text)
    }
  },
  contact: (message) => {
    return {
      phone_number: message.contact.phone_number,
      first_name: message.contact.first_name,
      last_name: message.contact.last_name
    }
  },
  location: (message) => {
    return {
      latitude: message.location.latitude,
      longitude: message.location.longitude
    }
  },
  venue: (message) => {
    return {
      latitude: message.venue.location.latitude,
      longitude: message.venue.location.longitude,
      title: message.venue.title,
      address: message.venue.address,
      foursquare_id: message.venue.foursquare_id
    }
  },
  voice: (message) => {
    const entities = message.caption_entities || []
    return {
      voice: message.voice.file_id,
      duration: message.voice.duration,
      caption: entities.reduceRight(applyEntity, message.caption),
      parse_mode: entities.length > 0 ? 'HTML' : ''
    }
  },
  audio: (message) => {
    const entities = message.caption_entities || []
    return {
      audio: message.audio.file_id,
      thumb: message.audio.thumb,
      duration: message.audio.duration,
      performer: message.audio.performer,
      title: message.audio.title,
      caption: entities.reduceRight(applyEntity, message.caption),
      parse_mode: entities.length > 0 ? 'HTML' : ''
    }
  },
  video: (message) => {
    const entities = message.caption_entities || []
    return {
      video: message.video.file_id,
      thumb: message.video.thumb,
      caption: entities.reduceRight(applyEntity, message.caption),
      parse_mode: entities.length > 0 ? 'HTML' : '',
      duration: message.video.duration,
      width: message.video.width,
      height: message.video.height,
      supports_streaming: !!message.video.supports_streaming
    }
  },
  document: (message) => {
    const entities = message.caption_entities || []
    return {
      document: message.document.file_id,
      caption: entities.reduceRight(applyEntity, message.caption),
      parse_mode: entities.length > 0 ? 'HTML' : ''
    }
  },
  sticker: (message) => {
    return {
      sticker: message.sticker.file_id
    }
  },
  photo: (message) => {
    const entities = message.caption_entities || []
    return {
      photo: message.photo[message.photo.length - 1].file_id,
      parse_mode: entities.length > 0 ? 'HTML' : '',
      caption: entities.reduceRight(applyEntity, message.caption)
    }
  },
  video_note: (message) => {
    return {
      video_note: message.video_note.file_id,
      thumb: message.video_note.thumb,
      length: message.video_note.length,
      duration: message.video_note.duration
    }
  },
  animation: (message) => {
    return {
      animation: message.animation.file_id,
      thumb: message.animation.thumb,
      duration: message.animation.duration
    }
  }
}

@@ -1113,24 +1113,66 @@
    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       parse_
@@ -1208,24 +1208,24 @@
 HTML' : '',%0A
-
       text: 
@@ -1314,32 +1314,74 @@
  %7B%0A    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       phone_numb
@@ -1546,32 +1546,74 @@
  %7B%0A    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       latitude: 
@@ -1727,24 +1727,66 @@
    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       latitu
@@ -2090,24 +2090,66 @@
    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       voice:
@@ -2427,24 +2427,66 @@
    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       audio:
@@ -2870,32 +2870,74 @@
 %5B%5D%0A    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       video: mes
@@ -3380,24 +3380,66 @@
    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       docume
@@ -3633,24 +3633,66 @@
    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       sticke
@@ -3814,24 +3814,66 @@
    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       photo:
@@ -4090,24 +4090,66 @@
    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       video_
@@ -4337,32 +4337,32 @@
  (message) =%3E %7B%0A
-
     return %7B%0A   
@@ -4354,24 +4354,66 @@
    return %7B%0A
+      reply_markup: message.reply_markup,%0A
       animat

copy reply markup. fix #725