-
Notifications
You must be signed in to change notification settings - Fork 3
/
core.clj
122 lines (118 loc) · 3.29 KB
/
core.clj
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
(ns telegrambot-lib.core
(:gen-class)
(:require [telegrambot-lib.config :as conf]
[telegrambot-lib.edit.core :as edit]
[telegrambot-lib.edit.protocol :refer [Edit]]
[telegrambot-lib.games.core :as games]
[telegrambot-lib.games.protocol :refer [Games]]
[telegrambot-lib.inline.core :as inline]
[telegrambot-lib.inline.protocol :refer [Inline]]
[telegrambot-lib.methods.core :as methods]
[telegrambot-lib.methods.protocol :refer [Methods]]
[telegrambot-lib.passport.core :as passport]
[telegrambot-lib.passport.protocol :refer [Passport]]
[telegrambot-lib.payments.core :as payments]
[telegrambot-lib.payments.protocol :refer [Payments]]
[telegrambot-lib.stickers.core :as stickers]
[telegrambot-lib.stickers.protocol :refer [Stickers]]
[telegrambot-lib.updates.core :as updates]
[telegrambot-lib.updates.protocol :refer [Updates]]
[potemkin :refer [import-vars]]))
(defrecord TBot [bot-token])
;; Add each part of the Telegram API to the TBot type.
(extend TBot Edit edit/behavior)
(extend TBot Games games/behavior)
(extend TBot Inline inline/behavior)
(extend TBot Methods methods/behavior)
(extend TBot Passport passport/behavior)
(extend TBot Payments payments/behavior)
(extend TBot Stickers stickers/behavior)
(extend TBot Updates updates/behavior)
(defn create
"Create a new Telegram Bot API instance.
No argument attempts to load the `bot-token` from the environment.
1 argument will use the passed in `bot-token`."
([]
(create (conf/get-token)))
([bot-token]
(map->TBot {:bot-token bot-token})))
(import-vars
[telegrambot-lib.edit.core
edit-message-text
edit-message-caption
edit-message-media
edit-message-reply-markup
stop-poll
delete-message]
[telegrambot-lib.games.core
send-game
set-game-score
get-game-high-scores]
[telegrambot-lib.inline.core
answer-inline-query]
[telegrambot-lib.methods.core
call
get-me
send-message
forward-message
send-photo
send-audio
send-document
send-video
send-animation
send-voice
send-video-note
send-media-group
send-location
edit-message-live-location
stop-message-live-location
send-venue
send-contact
send-poll
send-dice
send-chat-action
get-user-profile-photos
get-file
kick-chat-member
unban-chat-member
restrict-chat-member
promote-chat-member
set-chat-administrator-custom-title
set-chat-permissions
export-chat-invite-link
set-chat-photo
delete-chat-photo
set-chat-title
set-chat-description
pin-chat-message
unpin-chat-message
leave-chat
get-chat
get-chat-administrators
get-chat-members-count
get-chat-member
set-chat-sticker-set
delete-chat-sticker-set
answer-callback-query
set-my-commands
get-my-commands]
[telegrambot-lib.passport.core
set-passport-data-errors]
[telegrambot-lib.payments.core
send-invoice
answer-shipping-query
answer-precheckout-query]
[telegrambot-lib.stickers.core
send-sticker
get-sticker-set
upload-sticker-file
create-new-sticker-set
add-sticker-to-set
set-sticker-position-in-set
delete-sticker-from-set
set-sticker-set-thumb]
[telegrambot-lib.updates.core
get-updates
set-webhook
delete-webhook
get-webhook])