brainiac-discord 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/brainiac/plugins/discord/api.rb +7 -4
- data/lib/brainiac/plugins/discord/config.rb +2 -2
- data/lib/brainiac/plugins/discord/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 753751521918bfaf9dbbd4481272289b5e56109c8a6607a4f9bee5bb6d4158fe
|
|
4
|
+
data.tar.gz: 143f91e2f62daec56217695b50c6d11f7b22b8d02996600ff2bc04059dacfd92
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 199e2440232277e9068b31a59bd407dc5b6e3c736e313da1eed4b4ad64f0ebb5b6f7fce1edc7f3e928560534b7167ae64d945683432c792d83c99e6dbdabc9d2
|
|
7
|
+
data.tar.gz: 7625990b00a2b3e1629d11a7eed4ae5947e662cd28d1514dd65bcc1ad689eedf7e9c42020c7e6a884ee35594a2aa229207d144302e51f4ff4d8a6300665eaf84
|
data/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Each agent gets its own Discord bot. Users @mention @Galen or @GLaDOS directly
|
|
|
14
14
|
- **Emoji feedback** — non-reserved emoji reactions are logged as feedback to the agent's persona
|
|
15
15
|
- **Thread isolation** — conversations get their own threads with worktree persistence
|
|
16
16
|
- **Forum support** — cron jobs can post to forum channels
|
|
17
|
-
- **GIF support** — agents can search and embed GIFs via
|
|
17
|
+
- **GIF support** — agents can search and embed GIFs via Klipy API (formerly GIPHY)
|
|
18
18
|
- **Draft delivery** — file-based response delivery survives server restarts
|
|
19
19
|
|
|
20
20
|
## Installation
|
|
@@ -92,7 +92,8 @@ Stored in `~/.brainiac/discord.json`:
|
|
|
92
92
|
},
|
|
93
93
|
"authorized_role_ids": [],
|
|
94
94
|
"authorized_user_ids": [],
|
|
95
|
-
"giphy_api_key":
|
|
95
|
+
"giphy_api_key": null,
|
|
96
|
+
"klipy_api_key": "your-klipy-api-key"
|
|
96
97
|
}
|
|
97
98
|
```
|
|
98
99
|
|
|
@@ -192,18 +192,21 @@ module Brainiac
|
|
|
192
192
|
# --- GIF Search ---
|
|
193
193
|
|
|
194
194
|
def search_gif(query)
|
|
195
|
-
api_key = Config.
|
|
195
|
+
api_key = Config.klipy_api_key
|
|
196
196
|
return [] unless api_key
|
|
197
197
|
|
|
198
|
-
uri = URI("https://api.
|
|
199
|
-
uri.query = URI.encode_www_form(
|
|
198
|
+
uri = URI("https://api.klipy.com/v2/search")
|
|
199
|
+
uri.query = URI.encode_www_form(key: api_key, q: query, limit: 5, contentfilter: "medium")
|
|
200
200
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
201
201
|
http.use_ssl = true
|
|
202
202
|
response = http.get(uri)
|
|
203
203
|
return [] unless response.code.to_i == 200
|
|
204
204
|
|
|
205
205
|
data = JSON.parse(response.body)
|
|
206
|
-
(data["
|
|
206
|
+
(data["results"] || []).filter_map do |r|
|
|
207
|
+
url = r.dig("media_formats", "gif", "url") || r.dig("media_formats", "mediumgif", "url") || r["url"]
|
|
208
|
+
{ "url" => url } if url
|
|
209
|
+
end
|
|
207
210
|
rescue StandardError => e
|
|
208
211
|
LOG.warn "[Discord] GIF search error: #{e.message}" if defined?(LOG)
|
|
209
212
|
[]
|