diff --git a/Info.plist b/Info.plist
index 102c8d8..71d40c4 100644
--- a/Info.plist
+++ b/Info.plist
@@ -7,6 +7,6 @@
CFBundleShortVersionString
1.0.0
CFBundleVersion
- 20
+ 24
diff --git a/leucas/SendMessage.swift b/leucas/SendMessage.swift
index 0c28e86..27c2a14 100644
--- a/leucas/SendMessage.swift
+++ b/leucas/SendMessage.swift
@@ -10,7 +10,7 @@ import Foundation
struct DiscordMessage: Encodable {
var content: String
var username: String
- var avatarURL: String?
+ var avatar_url: String?
}
func sendMessage(apiURL: String, content: String, username: String, avatarURL: String? = nil) async {
@@ -22,7 +22,7 @@ func sendMessage(apiURL: String, content: String, username: String, avatarURL: S
var message = DiscordMessage(content: content, username: username)
if (avatarURL != nil) {
- message.avatarURL = avatarURL
+ message.avatar_url = avatarURL
}
let encoder = JSONEncoder()
@@ -43,7 +43,9 @@ func sendMessage(apiURL: String, content: String, username: String, avatarURL: S
do {
let (_, response) = try await URLSession.shared.upload(for: request, from: data)
- print(response)
+ let httpResponse = response as? HTTPURLResponse
+
+ print(httpResponse?.statusCode ?? "help-something-went-wrong-in-leucas")
}
catch {
print(error)
diff --git a/leucas/leucas_main.swift b/leucas/leucas_main.swift
index daa5856..ab0a2ac 100644
--- a/leucas/leucas_main.swift
+++ b/leucas/leucas_main.swift
@@ -27,11 +27,12 @@ struct leucas: AsyncParsableCommand {
// Continue on.
let script = readScript(path: file!)
- print("hello world")
- print(script)
-
for message in script.messages {
- await sendMessage(apiURL: script.characters[message.sender].api, content: message.content, username: script.characters[message.sender].name);
+ var profile = script.characters[message.sender].profile
+
+// print("apiURL: \(script.characters[message.sender].api), content: \(message.content), username: \(script.characters[message.sender].name), avatarURL: \(profile ?? "")")
+
+ await sendMessage(apiURL: script.characters[message.sender].api, content: message.content, username: script.characters[message.sender].name, avatarURL: profile);
try await Task.sleep(nanoseconds: UInt64(1e9))
}
}