Skip to content

Commit

Permalink
Automatically pull info from API when a manual signal is made by a re…
Browse files Browse the repository at this point in the history
…gistered rat
  • Loading branch information
SuperManifolds committed Dec 2, 2022
1 parent d8f0004 commit 9d1096c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/mechasqueak/RescueBoard/Rescue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ class Rescue {
self.createdAt = Date()
self.updatedAt = Date()
self.uploaded = false

if message.user.associatedAPIData != nil {
if let providedPlatform = GamePlatform.parsedFromText(text: signal.platform ?? ""), let rat = message.user.getRatRepresenting(platform: providedPlatform) {
self.client = rat.name
self.platform = rat.platform
self.expansion = rat.expansion
} else if let rat = message.user.currentRat {
self.client = rat.name
self.platform = rat.platform
self.expansion = rat.expansion
}
}
}

init? (text: String, clientName: String, fromCommand command: IRCBotCommand) {
Expand Down

0 comments on commit 9d1096c

Please sign in to comment.