reply()
method https://not-an-aardvark.github.io/snoowrap/Submission.html#reply__anchor
const asyncFunc = async () => {
try {
const r = new snoowrap({
userAgent: process.env.USERAGENT,
clientId: process.env.CLIENTID,
clientSecret: process.env.CLIENTSECRET,
refreshToken: process.env.REFRESHTOKEN,
});
// Submitting a link to a subreddit
r.getSubreddit('testingground4bots').submitLink({
title: getDate() + 'testing',
url: 'https://i.imgur.com/n5iOc72.gifv'}).then(function(response) {
console.log(response.permalink);
//const submission = r.getSubmission(response).reply('[this is a link](https://www.reddit.com' + response.permalink() + ') testing123');
});
}
catch (err){
console.log(err);
}
}
[Function: targetFunc] {
_promise_chain_cache: [Object: null prototype] {}
}
const submitLinkRes = await r
.getSubreddit('foo')
.submitLink({
title: " some cool title",
url: link,
flair_id: fooFlair.flair_template_id});
console.log('response: ', submitLinkRes);
const reply = await r.getSubmission(submitLinkRes).reply(comment);
console.log('reply: ', reply.permalink);
console.log('reply: ', reply);
I end up doing something like this to get the permalink of the submission
myPermalink = (reply.subreddit_name_prefixed + "/" + submitLinkRes._uri).replace(/ /g,'');
But obviously that's not as nice or as good as just getting the .permalink of the submission. I suppose I'm missing something obvious yes?