/
inline_query_result_builder.cr
97 lines (75 loc) · 2.57 KB
/
inline_query_result_builder.cr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
module Tourmaline
class Client
def self.build_inline_query_result(&block : InlineQueryResultBuilder ->)
builder = InlineQueryResultBuilder.new
yield builder
builder.results
end
def build_inline_query_result(&block : InlineQueryResultBuilder ->)
self.class.build_inline_query_result(&block)
end
class InlineQueryResultBuilder
getter results : Array(Tourmaline::InlineQueryResult)
def initialize
@results = [] of Tourmaline::InlineQueryResult
end
def article(*args, **opts)
results << InlineQueryResultArticle.new(*args, **opts)
end
def audio(*args, **opts)
results << InlineQueryResultAudio.new(*args, **opts)
end
def cached_audio(*args, **opts)
results << InlineQueryResultCachedAudio.new(*args, **opts)
end
def cached_document(*args, **opts)
results << InlineQueryResultCachedDocument.new(*args, **opts)
end
def cached_gif(*args, **opts)
results << InlineQueryResultCachedGif.new(*args, **opts)
end
def cached_mpeg4_gif(*args, **opts)
results << InlineQueryResultCachedMpeg4Gif.new(*args, **opts)
end
def cached_photo(*args, **opts)
results << InlineQueryResultCachedPhoto.new(*args, **opts)
end
def cached_sticker(*args, **opts)
results << InlineQueryResultCachedSticker.new(*args, **opts)
end
def cached_video(*args, **opts)
results << InlineQueryResultCachedVideo.new(*args, **opts)
end
def cached_voice(*args, **opts)
results << InlineQueryResultCachedVoice.new(*args, **opts)
end
def contact(*args, **opts)
results << InlineQueryResultContact.new(*args, **opts)
end
def document(*args, **opts)
results << InlineQueryResultDocument.new(*args, **opts)
end
def gif(*args, **opts)
results << InlineQueryResultGif.new(*args, **opts)
end
def location(*args, **opts)
results << InlineQueryResultLocation.new(*args, **opts)
end
def mpeg4_gif(*args, **opts)
results << InlineQueryResultMpeg4Gif.new(*args, **opts)
end
def photo(*args, **opts)
results << InlineQueryResultPhoto.new(*args, **opts)
end
def venue(*args, **opts)
results << InlineQueryResultVenue.new(*args, **opts)
end
def video(*args, **opts)
results << InlineQueryResultVideo.new(*args, **opts)
end
def game(*args, **opts)
results << InlineQueryResultGame.new(*args, **opts)
end
end
end
end