-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtesting.ex.example
More file actions
102 lines (92 loc) · 3.16 KB
/
Copy pathtesting.ex.example
File metadata and controls
102 lines (92 loc) · 3.16 KB
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
98
99
100
101
102
defmodule Testing do
alias Alexia.Model
alias Alexia.Model.{InlineQueryResult}
alias Alexia.Governor
require Logger
def text_command("/question",update,token) do
{:ok, _} = Alexia.send_message(token,Alexia.Governor.get_chat_id(update),
"Which color do you like most?",
# See also: https://hexdocs.pm/alexia/Alexia.Model.InlineKeyboardMarkup.html
reply_markup: %Model.InlineKeyboardMarkup{
inline_keyboard: [
[
%{
callback_data: "/choose green",
text: "Green like the Forests",
},
%{
callback_data: "/choose blue",
text: "Blue like the sky",
},
],
[%{
callback_data: "/typo-:p",
text: "Other", },
]
]
})
end
def text_command("/power",update,token) do
{:ok, _} = Alexia.send_message(token,Alexia.Governor.get_chat_id(update), "Who's the best?",
reply_markup: %Model.ReplyKeyboardMarkup{
one_time_keyboard: true,
keyboard: [
[
%{
request_location: true,
text: "Andrei C. The Original",
},
%{
request_contact: true,
text: "Enot Soulaviere's Inventor (Enotsoul)",
},
%{
text: "Then it must be MR Clinciu",
},
]
],
})
end
def callback_query_command("/choose"<>_,update,token) do
Logger.log :info, "Callback Query Command /choose"
case update.callback_query.data do
"/choose blue" ->
Alexia.answer_callback_query token, update.callback_query.id,
text: "Indeed you have good taste."
"/choose green" ->
Alexia.answer_callback_query token, update.callback_query.id,
text: "I can't agree more."
end
end
def inline_query_command("troll",update,token) do
:ok = Alexia.answer_inline_query token, update.inline_query.id, [
%InlineQueryResult.Article{
id: "1",
title: "TROLLS OFFICIAL TRAILER!",
thumb_url: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQXti_M1-prmVaQfCVX49m10hCEaGCls-zMPY7umR0ZNXAR-DYK",
description: "Did you mean TROLL?",
input_message_content: %{
message_text: "https://www.youtube.com/watch?v=xyjm5VQ11TQ",
}
},
%InlineQueryResult.Article{
id: "2",
title: "Science of Internet Trolls!",
thumb_url: "http://static.nautil.us/10977_7ca5eb06feca2d4d2029ef99de456a25.jpg",
description: "Did you mean the Science of internet TROLLs?",
input_message_content: %{
message_text: "https://www.youtube.com/watch?v=6Zxy_dScjsM",
}
},
%InlineQueryResult.Article{
id: "3",
title: "Remember the worst internet trolls",
thumb_url: "https://www.youtube.com/watch?v=ePQRgLVSqH0",
description: "How about the 10 worst internet trolls?",
input_message_content: %{
message_text: "https://www.youtube.com/watch?v=ePQRgLVSqH0",
}
}
]
end
end