Compare commits
2 Commits
f61f67a37c
...
883f701359
Author | SHA1 | Date |
---|---|---|
ThePendulum | 883f701359 | |
ThePendulum | 88266e5b03 |
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "kanbanmod",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "kanbanmod",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bhttp": "^1.2.8",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "kanbanmod",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
10
src/app.js
10
src/app.js
|
@ -6,6 +6,10 @@ const bhttp = require('bhttp');
|
|||
|
||||
const reddit = new snoowrap(config.reddit);
|
||||
|
||||
function log(msg) {
|
||||
console.log(`${new Date().toISOString()} ${msg}`);
|
||||
}
|
||||
|
||||
async function getWekanActorNames() {
|
||||
const wekanLoginRes = await bhttp.post(`${config.wekan.url}/users/login`, {
|
||||
username: config.wekan.username,
|
||||
|
@ -37,6 +41,8 @@ async function getWekanActorNames() {
|
|||
}
|
||||
|
||||
async function init() {
|
||||
log(`Retrieving current configuration from ${config.subreddit}`);
|
||||
|
||||
const automodConfig = await reddit.getSubreddit(config.subreddit).getWikiPage('config/automoderator').fetch();
|
||||
const automodLines = automodConfig.content_md.split('\n');
|
||||
const actorLineIndex = automodLines.findIndex((line) => line.includes(config.actorCommentKey)) + 1;
|
||||
|
@ -55,14 +61,14 @@ async function init() {
|
|||
reason: 'Synced kanban actor names',
|
||||
});
|
||||
|
||||
console.log(`${new Date().toISOString()} Sync complete, resyncing in ${config.interval} minutes, set ${newActorLine}`);
|
||||
log(`Sync complete, resyncing in ${config.interval} minutes, set ${newActorLine}`);
|
||||
|
||||
setTimeout(() => init(), config.interval * 60 * 1000);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`${new Date().toISOString()} Sync complete, set ${newActorLine}`);
|
||||
log(`Sync complete, set ${newActorLine}`);
|
||||
}
|
||||
|
||||
init();
|
||||
|
|
Loading…
Reference in New Issue