add default post amt customisation

This commit is contained in:
hgw 2023-10-02 02:11:25 +00:00
parent fbd3505e3c
commit 6727a1268d
4 changed files with 10 additions and 8 deletions

4
bot.js
View File

@ -43,7 +43,7 @@ async function feed(chan, provfeed, n) {
return;
}
if (n === undefined) {
var n = 5;
var n = config.feed.default_amount;
}
const worker = new Worker('./commands/feed.js', {
workerData: {
@ -63,7 +63,7 @@ async function twitter(chan, provfeed, n) {
return;
}
if (n === undefined) {
var n = 5;
var n = config.twitter.default_amount;
}
const worker = new Worker('./commands/twitter.js', {
workerData: {

View File

@ -50,8 +50,8 @@ async function fetchFeed(feedURL, n) {
var n = newFeed.items.length;
content.push(warningMsg+" Your requested post amount exceeded the total available. Reverting to " + newFeed.items.length);
} else if (n < 1) {
var n = 5
content.push(warningMsg+" You requested a number less than 1. Reverting to 5");
var n = config.feed.default_amount
content.push(warningMsg+" You requested a number less than 1. Reverting to default ("+config.feed.default_amount+")");
}
//for (let i = 0; i < newFeed.items.length; i++) {
for (let i = 0; i < n; i++) {

View File

@ -57,8 +57,8 @@ async function fetchFeed(feedURL, n) {
var n = newFeed.items.length;
content.push(warningMsg+" Your requested post amount exceeded the total available. Reverting to " + newFeed.items.length);
} else if (n < 1) {
var n = 5
content.push(warningMsg+" You requested a number less than 1. Reverting to 5");
var n = config.twitter.default_amount
content.push(warningMsg+" You requested a number less than 1. Reverting to default ("+config.twitter.default_amount+")");
}
for (let i = 0; i < n; i++) {

View File

@ -27,13 +27,15 @@
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 13.4; rv:109.0) Gecko/20100101 Firefox/114.0",
"body_max_chars": "200",
"time_format": "DD MMM YYYY HH:mm:ss ZZ",
"timezone": "Pacific/Auckland"
"timezone": "Pacific/Auckland",
"default_amount": "5"
},
"twitter": {
"nitter_instances": [
"nitter.1d4.us",
"nitter.it",
"nitter.pufe.org"
]
],
"default_amount": "5"
}
}