brainiac-discord 0.0.24 → 0.0.25
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b993813772110a77d5ac815a314c8eb7853083ac9cbd0c3322579e1f1b80ee40
|
|
4
|
+
data.tar.gz: 63d422ec1ffe6e8d3c12b267c5f14061d23651e863e69f891f6d558a7e553010
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72e8c931e9fb970da65743314407deebb8096f6f6e53263432ccf34fa637eed3e72b814df9de299f55f4ef162bf7bd50192c2c9a96cc077bb96defca272e06da
|
|
7
|
+
data.tar.gz: 476d43b17b45b289e661da974062445f1ff1a660410ab5679fd3a41777fbfaecccc7abe010b1d272cc848dc3610108fd1561b9517c140576ff58d5cff3efa51a
|
|
@@ -44,7 +44,8 @@ module Brainiac
|
|
|
44
44
|
return
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
existing_id = discord_config.dig("user_mappings", display_name)
|
|
48
|
+
token ||= prompt_for_token(display_name, entry["open_browser"], existing_id)
|
|
48
49
|
return unless token
|
|
49
50
|
|
|
50
51
|
me = request(:get, "/users/@me", token)
|
|
@@ -68,15 +69,24 @@ module Brainiac
|
|
|
68
69
|
|
|
69
70
|
private
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
# With a user_mappings entry the app already exists (the token was lost
|
|
73
|
+
# or rotated), so send the user straight to its Bot tab instead of
|
|
74
|
+
# "New Application". A bot's user ID is its application ID.
|
|
75
|
+
def prompt_for_token(display_name, browser, existing_id = nil)
|
|
72
76
|
return nil unless $stdin.tty?
|
|
73
77
|
|
|
78
|
+
url = existing_id ? "#{PORTAL_URL}/#{existing_id}/bot" : PORTAL_URL
|
|
74
79
|
puts ""
|
|
75
|
-
puts " [Discord] Opening the developer portal in your browser…" if browser && open_url(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
puts " [Discord] Opening the developer portal in your browser…" if browser && open_url(url)
|
|
81
|
+
if existing_id
|
|
82
|
+
puts " [Discord] #{display_name} already has a Discord app, but its bot token isn't saved."
|
|
83
|
+
puts " #{url} → Reset Token → copy it"
|
|
84
|
+
else
|
|
85
|
+
puts " [Discord] Create a bot for #{display_name} (the only manual step):"
|
|
86
|
+
puts " 1. #{PORTAL_URL} → New Application → name it \"#{display_name}\""
|
|
87
|
+
puts " 2. Bot tab → Reset Token → copy it"
|
|
88
|
+
puts " Name, avatar, description and Message Content intent are set automatically."
|
|
89
|
+
end
|
|
80
90
|
print " Bot token (blank to skip): "
|
|
81
91
|
token = read_secret
|
|
82
92
|
puts ""
|