Skip to content

Commit

Permalink
Fixed undefined author title, removed example source JSON contents
Browse files Browse the repository at this point in the history
  • Loading branch information
synzen committed Jan 25, 2018
1 parent 3ef61ad commit 83103d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 53 deletions.
4 changes: 2 additions & 2 deletions commands/rssembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const embedProperties = [['Color', 'The sidebar color of the embed\nThis MUST be
['Author URL', 'Clicking on the Atuhor Title will lead to this URL.\nThis MUST be a link.', 'authorURL'],
['Author Avatar URL', 'The avatar picture to the left of author title.\nThis MUST be a link to an image. If an Author Title is not specified, the Author Avatar URL will not be shown.', 'authorAvatarURL'],
['Title', 'Subtitle of the embed\nAccepts placeholders', 'title'],
['Title URL', 'Clicking on the Title will lead to this URL.\nThis MUST be a link. By default this is set to the feed\'s url', 'url'],
['Image URL', 'The main image on the bottom of the embed.\nThis MUST be a link to an image, OR an {imageX} placeholder', 'imageURL'],
['Thumbnail URL', 'The picture on the right hand side of the embed\nThis MUST be a link to an image, OR an {imageX} placeholder', 'thumbnailURL'],
['Message', 'Main message of the embed\nAccepts placeholders', 'message'],
['Footer Text', 'The bottom-most text\nAccepts placeholders', 'footerText']
['Footer Text', 'The bottom-most text\nAccepts placeholders', 'footerText'],
['URL', 'Clicking on the Title/Thumbnail will lead to this URL.\nThis MUST be a link. By default this is set to the feed\'s url', 'url']]

const imageFields = ['thumbnailURL', 'authorAvatarURL', 'imageURL']
const currentGuilds = require('../util/storage.js').currentGuilds
Expand Down
4 changes: 2 additions & 2 deletions rss/translator/embed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Discord = require('discord.js')

function isStr(str) { return typeof str === 'string' }
function isStr(str) { return str && typeof str === 'string' }

module.exports = function (rssList, rssName, article) {
const embed = new Discord.RichEmbed()
Expand All @@ -17,7 +17,7 @@ module.exports = function (rssList, rssName, article) {
} else embed.setColor(parseInt(embedSpecs.color, 10))
} else if (isStr(embedSpecs.color) && embedSpecs.color.startsWith('#') && embedSpecs.color.length === 7) embed.setColor(embedSpecs.color)

embed.setAuthor(isStr(embedSpecs.authorTitle) ? article.convertKeywords(embedSpecs.authorTitle) : undefined, isStr(embedSpecs.authorAvatarURL) ? article.convertKeywords(embedSpecs.authorAvatarURL) : undefined, isStr(embedSpecs.authorURL) ? article.convertKeywords(embedSpecs.authorURL) : undefined)
if (isStr(embedSpecs.authorTitle)) embed.setAuthor(article.convertKeywords(embedSpecs.authorTitle), isStr(embedSpecs.authorAvatarURL) ? article.convertKeywords(embedSpecs.authorAvatarURL) : undefined, isStr(embedSpecs.authorURL) ? article.convertKeywords(embedSpecs.authorURL) : undefined)

if (isStr(embedSpecs.thumbnailURL)) embed.setThumbnail(article.convertImgs(embedSpecs.thumbnailURL))

Expand Down
49 changes: 0 additions & 49 deletions sources/guild_id_here.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,2 @@
{
"name": "my guild name",
"id": "123456",
"sources": {
"WarframeTwitter": {
"link": "https://queryfeed.net/tw?q=%40PlayWarframe",
"channel": "34523124455",
"maxAge": 2,
"message": "{empty}",
"embedMessage": {
"enabled": 1,
"properties": {
"color": 3447003,
"authorTitle": "Warframe @PlayWarframe",
"authorAvatarURL": "http://icons.iconarchive.com/icons/uiconstock/socialmedia/512/Twitter-icon.png",
"thumbnailURL": "https://pbs.twimg.com/profile_images/797287460199862272/mG1KEwQ2.jpg",
"message": "{description}",
"footerText": "{date}",
"url": ""
}
}
},
"257938647771250688_https://www.rt.com": {
"link": "https://www.rt.com/rss/",
"channel": "257931586721250688",
"maxAge": 3,
"message": "This description will be affected by the regexOps defined for description in the guild profile file for this feed. In this case, all new lines were removed:\n\n{description}",
"filters": {
"title": ["first", "second"],
"description": ["more!"]
},
"regexOps": {
"description": [{
"search": "(?:\r\n|\r|\n)",
"replacement": {
"type": "regex",
"content": "",
"matchNumber": 0
},
"flags": "gi"
}]
}
},
"WashingtonPost": {
"enabled": 0,
"link": "http://feeds.washingtonpost.com/rss/sports",
"channel": "4523124436",
"message": "A new article on sports!\n{title}\n\n{description}\nBy: {author}\n\n {link}"
}
}
}

0 comments on commit 83103d1

Please sign in to comment.