Added option to index (specified) ignored posts. Saving index through save module, and it now notifies the user that an index has been written.
This commit is contained in:
@@ -14,7 +14,7 @@ async function getIndex(user) {
|
||||
|
||||
return yaml.safeLoad(indexFile);
|
||||
} catch (error) {
|
||||
console.log('\x1b[33m%s\x1b[0m', `Could not load index file for '${user.name}' at '${indexFilePath}': ${error}`);
|
||||
console.log('\x1b[33m%s\x1b[0m', `No index file found for '${user.name}' at '${indexFilePath}'`);
|
||||
|
||||
return { profile: { image: null, description: null }, posts: [] };
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ async function getUser(username, reddit) {
|
||||
|
||||
async function getPosts(username, reddit, args) {
|
||||
try {
|
||||
const user = await reddit.getUser(username).getSubmissions({
|
||||
const submissions = await reddit.getUser(username).getSubmissions({
|
||||
sort: args.sort,
|
||||
limit: Infinity,
|
||||
});
|
||||
|
||||
return user;
|
||||
return submissions;
|
||||
} catch (error) {
|
||||
console.log('\x1b[31m%s\x1b[0m', `Failed to fetch posts from reddit user '${username}': ${error.message} (https://reddit.com/user/${username})`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user