aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2016-03-31 19:26:05 (UTC)
committerjan <jan@ruken.pw>2016-03-31 19:26:05 (UTC)
commitac1f32f068a8c1e856b6db00a8058d9bf372a006 (patch)
tree8569d00a99dbe2f973eb934ba750eb5d3e0d96b2
initial commit
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock442
-rw-r--r--Cargo.toml7
-rw-r--r--src/main.rs23
4 files changed, 473 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..eb5a316
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
target
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..e28540a
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,442 @@
1[root]
2name = "luggas"
3version = "0.1.0"
4dependencies = [
5 "telegram-bot 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
6]
7
8[[package]]
9name = "aho-corasick"
10version = "0.5.1"
11source = "registry+https://github.com/rust-lang/crates.io-index"
12dependencies = [
13 "memchr 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
14]
15
16[[package]]
17name = "bitflags"
18version = "0.4.0"
19source = "registry+https://github.com/rust-lang/crates.io-index"
20
21[[package]]
22name = "buf_redux"
23version = "0.1.3"
24source = "registry+https://github.com/rust-lang/crates.io-index"
25
26[[package]]
27name = "cookie"
28version = "0.2.2"
29source = "registry+https://github.com/rust-lang/crates.io-index"
30dependencies = [
31 "openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
32 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
33 "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
34 "url 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
35]
36
37[[package]]
38name = "env_logger"
39version = "0.3.2"
40source = "registry+https://github.com/rust-lang/crates.io-index"
41dependencies = [
42 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
43 "regex 0.1.61 (registry+https://github.com/rust-lang/crates.io-index)",
44]
45
46[[package]]
47name = "gcc"
48version = "0.3.26"
49source = "registry+https://github.com/rust-lang/crates.io-index"
50
51[[package]]
52name = "gdi32-sys"
53version = "0.1.1"
54source = "registry+https://github.com/rust-lang/crates.io-index"
55dependencies = [
56 "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
57]
58
59[[package]]
60name = "hpack"
61version = "0.2.0"
62source = "registry+https://github.com/rust-lang/crates.io-index"
63dependencies = [
64 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
65]
66
67[[package]]
68name = "httparse"
69version = "1.1.2"
70source = "registry+https://github.com/rust-lang/crates.io-index"
71
72[[package]]
73name = "hyper"
74version = "0.7.2"
75source = "registry+https://github.com/rust-lang/crates.io-index"
76dependencies = [
77 "cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
78 "httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
79 "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
80 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
81 "mime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
82 "num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
83 "openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
84 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
85 "solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
86 "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
87 "traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
88 "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
89 "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
90 "url 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
91]
92
93[[package]]
94name = "kernel32-sys"
95version = "0.2.1"
96source = "registry+https://github.com/rust-lang/crates.io-index"
97dependencies = [
98 "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
99 "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
100]
101
102[[package]]
103name = "language-tags"
104version = "0.2.2"
105source = "registry+https://github.com/rust-lang/crates.io-index"
106
107[[package]]
108name = "lazy_static"
109version = "0.1.15"
110source = "registry+https://github.com/rust-lang/crates.io-index"
111
112[[package]]
113name = "libc"
114version = "0.2.9"
115source = "registry+https://github.com/rust-lang/crates.io-index"
116
117[[package]]
118name = "libressl-pnacl-sys"
119version = "2.1.6"
120source = "registry+https://github.com/rust-lang/crates.io-index"
121dependencies = [
122 "pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
123]
124
125[[package]]
126name = "log"
127version = "0.3.5"
128source = "registry+https://github.com/rust-lang/crates.io-index"
129dependencies = [
130 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
131]
132
133[[package]]
134name = "matches"
135version = "0.1.2"
136source = "registry+https://github.com/rust-lang/crates.io-index"
137
138[[package]]
139name = "memchr"
140version = "0.1.10"
141source = "registry+https://github.com/rust-lang/crates.io-index"
142dependencies = [
143 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
144]
145
146[[package]]
147name = "mempool"
148version = "0.2.0"
149source = "registry+https://github.com/rust-lang/crates.io-index"
150
151[[package]]
152name = "mime"
153version = "0.1.3"
154source = "registry+https://github.com/rust-lang/crates.io-index"
155dependencies = [
156 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
157 "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
158]
159
160[[package]]
161name = "mime_guess"
162version = "1.5.0"
163source = "registry+https://github.com/rust-lang/crates.io-index"
164dependencies = [
165 "mime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
166 "phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
167 "phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
168]
169
170[[package]]
171name = "multipart"
172version = "0.5.1"
173source = "registry+https://github.com/rust-lang/crates.io-index"
174dependencies = [
175 "buf_redux 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
176 "env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
177 "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
178 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
179 "memchr 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
180 "mime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
181 "mime_guess 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
182 "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
183 "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
184]
185
186[[package]]
187name = "num"
188version = "0.1.31"
189source = "registry+https://github.com/rust-lang/crates.io-index"
190
191[[package]]
192name = "num_cpus"
193version = "0.2.11"
194source = "registry+https://github.com/rust-lang/crates.io-index"
195dependencies = [
196 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
197]
198
199[[package]]
200name = "openssl"
201version = "0.7.8"
202source = "registry+https://github.com/rust-lang/crates.io-index"
203dependencies = [
204 "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
205 "gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
206 "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
207 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
208 "openssl-sys 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
209 "openssl-sys-extras 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
210]
211
212[[package]]
213name = "openssl-sys"
214version = "0.7.8"
215source = "registry+https://github.com/rust-lang/crates.io-index"
216dependencies = [
217 "gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
218 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
219 "libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
220 "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
221 "user32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
222]
223
224[[package]]
225name = "openssl-sys-extras"
226version = "0.7.8"
227source = "registry+https://github.com/rust-lang/crates.io-index"
228dependencies = [
229 "gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
230 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
231 "openssl-sys 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
232]
233
234[[package]]
235name = "phf"
236version = "0.7.14"
237source = "registry+https://github.com/rust-lang/crates.io-index"
238dependencies = [
239 "phf_shared 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
240]
241
242[[package]]
243name = "phf_codegen"
244version = "0.7.14"
245source = "registry+https://github.com/rust-lang/crates.io-index"
246dependencies = [
247 "phf_generator 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
248 "phf_shared 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
249]
250
251[[package]]
252name = "phf_generator"
253version = "0.7.14"
254source = "registry+https://github.com/rust-lang/crates.io-index"
255dependencies = [
256 "phf_shared 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
257 "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
258]
259
260[[package]]
261name = "phf_shared"
262version = "0.7.14"
263source = "registry+https://github.com/rust-lang/crates.io-index"
264
265[[package]]
266name = "pkg-config"
267version = "0.3.8"
268source = "registry+https://github.com/rust-lang/crates.io-index"
269
270[[package]]
271name = "pnacl-build-helper"
272version = "1.4.10"
273source = "registry+https://github.com/rust-lang/crates.io-index"
274dependencies = [
275 "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
276]
277
278[[package]]
279name = "rand"
280version = "0.3.14"
281source = "registry+https://github.com/rust-lang/crates.io-index"
282dependencies = [
283 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
284]
285
286[[package]]
287name = "regex"
288version = "0.1.61"
289source = "registry+https://github.com/rust-lang/crates.io-index"
290dependencies = [
291 "aho-corasick 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
292 "memchr 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
293 "mempool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
294 "regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
295 "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
296]
297
298[[package]]
299name = "regex-syntax"
300version = "0.3.1"
301source = "registry+https://github.com/rust-lang/crates.io-index"
302
303[[package]]
304name = "rustc-serialize"
305version = "0.3.18"
306source = "registry+https://github.com/rust-lang/crates.io-index"
307
308[[package]]
309name = "rustc_version"
310version = "0.1.7"
311source = "registry+https://github.com/rust-lang/crates.io-index"
312dependencies = [
313 "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
314]
315
316[[package]]
317name = "semver"
318version = "0.1.20"
319source = "registry+https://github.com/rust-lang/crates.io-index"
320
321[[package]]
322name = "serde"
323version = "0.6.15"
324source = "registry+https://github.com/rust-lang/crates.io-index"
325dependencies = [
326 "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
327]
328
329[[package]]
330name = "solicit"
331version = "0.4.4"
332source = "registry+https://github.com/rust-lang/crates.io-index"
333dependencies = [
334 "hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
335 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
336]
337
338[[package]]
339name = "telegram-bot"
340version = "0.4.2"
341source = "registry+https://github.com/rust-lang/crates.io-index"
342dependencies = [
343 "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
344 "multipart 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
345 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
346 "url 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
347]
348
349[[package]]
350name = "tempdir"
351version = "0.3.4"
352source = "registry+https://github.com/rust-lang/crates.io-index"
353dependencies = [
354 "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
355]
356
357[[package]]
358name = "time"
359version = "0.1.34"
360source = "registry+https://github.com/rust-lang/crates.io-index"
361dependencies = [
362 "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
363 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
364 "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
365]
366
367[[package]]
368name = "traitobject"
369version = "0.0.1"
370source = "registry+https://github.com/rust-lang/crates.io-index"
371
372[[package]]
373name = "typeable"
374version = "0.1.2"
375source = "registry+https://github.com/rust-lang/crates.io-index"
376
377[[package]]
378name = "unicase"
379version = "1.4.0"
380source = "registry+https://github.com/rust-lang/crates.io-index"
381dependencies = [
382 "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
383]
384
385[[package]]
386name = "unicode-bidi"
387version = "0.2.3"
388source = "registry+https://github.com/rust-lang/crates.io-index"
389dependencies = [
390 "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
391]
392
393[[package]]
394name = "unicode-normalization"
395version = "0.1.2"
396source = "registry+https://github.com/rust-lang/crates.io-index"
397
398[[package]]
399name = "url"
400version = "0.5.7"
401source = "registry+https://github.com/rust-lang/crates.io-index"
402dependencies = [
403 "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
404 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
405 "unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
406 "unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
407 "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
408]
409
410[[package]]
411name = "user32-sys"
412version = "0.1.2"
413source = "registry+https://github.com/rust-lang/crates.io-index"
414dependencies = [
415 "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
416 "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
417]
418
419[[package]]
420name = "utf8-ranges"
421version = "0.1.3"
422source = "registry+https://github.com/rust-lang/crates.io-index"
423
424[[package]]
425name = "uuid"
426version = "0.1.18"
427source = "registry+https://github.com/rust-lang/crates.io-index"
428dependencies = [
429 "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
430 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
431]
432
433[[package]]
434name = "winapi"
435version = "0.2.6"
436source = "registry+https://github.com/rust-lang/crates.io-index"
437
438[[package]]
439name = "winapi-build"
440version = "0.1.1"
441source = "registry+https://github.com/rust-lang/crates.io-index"
442
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..4737ab2
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,7 @@
1[package]
2name = "luggas"
3version = "0.1.0"
4authors = ["jan <jan@ruken.pw>"]
5
6[dependencies]
7telegram-bot = "0.4"
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..4cca6d1
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,23 @@
1extern crate telegram_bot;
2
3use telegram_bot::{Api, ListeningMethod, ListeningAction, MessageType, Update};
4
5fn main() {
6 let api = Api::from_env("TELEGRAM_BOT_TOKEN").unwrap();
7
8 println!("api started: {:?}", api.get_me());
9
10 let mut listener = api.listener(ListeningMethod::LongPoll(None));
11 let res = listener.listen(|u| {
12 if let Some(m) = u.message {
13 let name = m.from.first_name;
14
15 println!("got message from {}", name);
16 };
17 Ok(ListeningAction::Continue)
18 });
19
20 if let Err(e) = res {
21 panic!(e);
22 }
23}