User:Theleekycauldron/Scripts/PSHAW/dependencies/Hook.js: Difference between revisions

Content deleted Content added
more code
should be done
Line 12:
copies or substantial portions of the Software.
*/
 
class Hook {
constructor(id,content,credits){
Line 55 ⟶ 56:
}
var params = {
action: 'edit',
title: this.title,
summary: `Giving credit for ${credit.article}`,
section: 'new',
sectiontitle: `DYK for ${credit.article}`,
text: res,
format: 'json'
}
api.postWithToken( 'csrf', params );
}
Line 68 ⟶ 69:
tag_talk(file){
let res;
let today = new Date()
today = `${today.getUTCDate()} ${["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][today.getUTCMonth()]} ${today.getUTCFullYear()}`
for (let credit of credits){
res = `{{DYK talk|${{subst:TODAY}today}|entry=${this.hook}|${file}}}`
get_section([`Talk:${credit.article}`],"user|content",null,"older",0).then((talktext) => {
talktext += `\n${res}`
var params = {
action: 'edit',
title: `Talk:${credit.article}`,
summary: `Article appeared on [[WP:DYK|DYK]] on ${today}, adding {{[[Template:DYK talk|DYK talk]]}}`,
section: '0',
text: talktext,
format: 'json'
}
api.postWithToken( 'csrf', params );
})
}
}