| 1 | # coding: utf-8 |
| 2 | module Plugin::Mastodon |
| 3 | # https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#emoji |
| 4 | class Emoji < Diva::Model |
| 5 | extend Memoist |
| 6 | #register :mastodon_emoji, name: "Mastodon絵文字(Mastodon)" |
| 7 | |
| 8 | field.string :shortcode, required: true |
| 9 | field.uri :static_url, required: true |
| 10 | field.uri :url, required: true |
| 11 | |
| 12 | def description |
| 13 | ":#{shortcode}:" |
| 14 | end |
| 15 | |
| 16 | memoize def inline_photo |
| 17 | Plugin.collect(:photo_filter, static_url, Pluggaloid::COLLECT).first |
| 18 | end |
| 19 | |
| 20 | def path |
| 21 | "/#{static_url.host}/#{shortcode}" |
| 22 | end |
| 23 | |
| 24 | def inspect |
| 25 | "mastodon-emoji(:#{shortcode}:)" |
| 26 | end |
| 27 | end |
| 28 | end |