View difference between Paste ID: jtQRQMpK and br2AvPz9
SHOW: | | - or go back to the newest paste.
1
        m = Nadia.Parser.parse_result(message, nil)
2
3-
        if entities do
3+
        m = if m.entities do
4
          entities = Enum.map(
5
            m.entities,
6
            fn(entity) ->
7
              case entity.type do
8
                "bot_command" -> Map.put(entity, :bot_command, m.text |> String.slice(entity.offset, entity.length) |> String.trim("/"))
9
                _ -> entity
10
              end
11
            end
12
          )
13-
          m = %{m | entities: entities}
13+
          %{m | entities: entities}
14
        end
15
16
        m