Skip to content

Commit 8f62dbf

Browse files
committed
added 'oneshot' config option
1 parent dcf502f commit 8f62dbf

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ module.exports = config;
1515
config.domains = ["pastebin.com"]; // pastebin/etc domans
1616
config.dbFilename = "database.db"; // the database file to store the collection
1717
config.parse = false; // archive chat history on login
18+
config.oneshot = false; // quit after archiving chat history
1819
config.port = 8080; // the port to server the http frontend on
1920
config.token = "PUT YOUR TOKEN HERE"; // discord login token
2021
```
2122

2223
Run the bot with `npm run bot`.
24+
25+
Run the server with `npm run server`.

bot.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ function scanChannel(channel)
180180
{
181181
console.log(`Finished scanning channel #${channel.name}!`);
182182
// if that's all of them, then quit!
183-
if(--channelsRemaining == 0) quit("Scanning complete.");
183+
if(--channelsRemaining == 0)
184+
if(config.oneshot) quit("Scanning complete.");
185+
else console.log("Scanning complete.");
184186
}
185187
}).catch(console.error);
186188
};
@@ -219,14 +221,14 @@ client.on("ready", () => {
219221

220222
// when a discord message is received
221223
client.on("message", message => {
222-
if(config.parse) return; // ignore if in parse mode
224+
if(config.parse && config.oneshot) return; // ignore if in parse mode
223225
logMessage(message); // log the message to console
224226
processMessage(message); // and process it normally
225227
});
226228

227229
// when a discord message is edited
228230
client.on("messageUpdate", (oldMessage, newMessage) => {
229-
if(config.parse) return; // ignore if in parse mode
231+
if(config.parse && config.oneshot) return; // ignore if in parse mode
230232
logMessage(newMessage, true); // log the message to console
231233
processMessage(newMessage, true); // and process it normally
232234
});

0 commit comments

Comments
 (0)