Fix articles not posting if content too long for discord

Also fix incorrect name in example commands
This commit is contained in:
benji7425 2017-11-26 23:37:54 +00:00
parent d2fa55beae
commit 21c51fbc3d
4 changed files with 14 additions and 14 deletions

View File

@ -22,31 +22,31 @@ If you agree, invite to your server with [this link](https://discordapp.com/oaut
## Setup
You can ask the bot for help with commands by typing `@RSS_Bot help`
You can ask the bot for help with commands by typing `@RSS Bot help`
### Add a new feed
`@RSS_Bot add-feed <url> <#channel> [@role]`
`@RSS Bot add-feed <url> <#channel> [@role]`
- *url* must be an RSS feed URL
- *#channel* must be a channel mention
- *@role* must be a role mention (make sure "Anyone can mention this role" is turned on during setup)
Example:
`@RSS_Bot add-feed http://lorem-rss.herokuapp.com/feed?unit=second&interval=30 #rss-posts @subscribers`
`@RSS Bot add-feed http://lorem-rss.herokuapp.com/feed?unit=second&interval=30 #rss-posts @subscribers`
### View feeds configured for this server
`@RSS_Bot view-feeds`
`@RSS Bot view-feeds`
This will display a list of RSS feeds configured for this server, along with a unique ID for each
### Remove a configured feed
`@RSS_Bot remove-feed <feed-id>`
`@RSS Bot remove-feed <feed-id>`
To remove a feed you will need it's unique ID, which you can find by running the above *view-feeds* command
Example:
`@RSS_Bot remove-feed ABc-123dEF`
`@RSS Bot remove-feed ABc-123dEF`
## Permissions

View File

@ -1,4 +1,5 @@
{
"maxCacheSize": 100,
"feedCheckIntervalSec": 30
"feedCheckIntervalSec": 30,
"charLimit": 500
}

View File

@ -1,7 +1,6 @@
//my imports
const DiscordUtil = require("../../discord-bot-core").util;
//external lib imports
// @ts-ignore
const Config = require("../config.json");
const Dns = require("dns"); //for host resolution checking
const Url = require("url"); //for url parsing
const FeedRead = require("feed-read"); //for extracing new links from RSS feeds
@ -34,7 +33,7 @@ module.exports = class FeedData {
};
}
/**@param param*/
/**@param guild*/
updatePastPostedLinks(guild) {
const channel = guild.channels.get(this.channelID);
@ -53,7 +52,7 @@ module.exports = class FeedData {
});
}
/**@param param */
/**@param guild */
fetchLatest(guild) {
Dns.resolve(Url.parse(this.url).host || "", err => {
if (err)
@ -100,7 +99,7 @@ function formatPost(article) {
if (article.title)
message += `\n**${article.title}**`;
if (article.content)
message += `\n${article.content}`;
message += article.content.length > Config.charLimit ? "\nArticle content too long for a single Discord message!" : `\n${article.content}`;
if (article.link)
message += `\n\n${normaliseUrl(article.link)}`;
return message;

View File

@ -3,7 +3,7 @@
"main": "app/index.js",
"scripts": {
"postinstall": "cd ./discord-bot-core && npm install",
"start": "node app/index.js token.json guilds.json --max-old-space-size=64"
"start": "node app/index.js token.json guilds.json --max-old-space-size=64 --name=rss-feed"
},
"dependencies": {
"discord.js": "11.2.0",