SHOW:
|
|
- or go back to the newest paste.
1 | m = Nadia.Parser.parse_result(message, nil) | |
2 | ||
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 | entities: entities} | |
14 | else | |
15 | m | |
16 | end | |
17 | ||
18 | m |