Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
Adds fallback text to responses.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamStonehouse authored and chuckharmston committed Feb 17, 2017
1 parent f2f4034 commit a0d27d8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/response-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TextResponse {
let parts = response.body.split('\n');
const attachmentTitle = parts.shift();
return {
fallback: `${attachmentTitle} - ${parts.join(' ')}`,
text: parts.join('\n'),
title: attachmentTitle,
title_link: response.headers['x-scryfall-card'],
Expand Down Expand Up @@ -76,6 +77,7 @@ class ImageResponse extends TextResponse {
makeAttachment(response) {
let parts = response.body.split('\n');
return {
fallback: `Image: ${response.headers['x-scryfall-card-image']}`,
image_url: response.headers['x-scryfall-card-image'],
title: parts[0].match(/^([^{]+)/)[0].trim(),
title_link: response.headers['x-scryfall-card'],
Expand All @@ -92,6 +94,7 @@ class PriceResponse extends TextResponse {
let parts = response.body.split('\n');
const u = 'https://www.google.com';
return {
fallback: `Prices for: ${this.cardName}`,
fields: [
{ title: `Kaladesh`, value: `<${u}|$0.16>`, short: true },
{ title: `Magic Origins`, value: `<${u}|$0.24>, <${u}|0.01 tix>`, short: true }
Expand Down

0 comments on commit a0d27d8

Please sign in to comment.