File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,11 @@ module.exports = config;
15
15
config .domains = [" pastebin.com" ]; // pastebin/etc domans
16
16
config .dbFilename = " database.db" ; // the database file to store the collection
17
17
config .parse = false ; // archive chat history on login
18
+ config .oneshot = false ; // quit after archiving chat history
18
19
config .port = 8080 ; // the port to server the http frontend on
19
20
config .token = " PUT YOUR TOKEN HERE" ; // discord login token
20
21
```
21
22
22
23
Run the bot with ` npm run bot ` .
24
+
25
+ Run the server with ` npm run server ` .
Original file line number Diff line number Diff line change @@ -180,7 +180,9 @@ function scanChannel(channel)
180
180
{
181
181
console . log ( `Finished scanning channel #${ channel . name } !` ) ;
182
182
// 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." ) ;
184
186
}
185
187
} ) . catch ( console . error ) ;
186
188
} ;
@@ -219,14 +221,14 @@ client.on("ready", () => {
219
221
220
222
// when a discord message is received
221
223
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
223
225
logMessage ( message ) ; // log the message to console
224
226
processMessage ( message ) ; // and process it normally
225
227
} ) ;
226
228
227
229
// when a discord message is edited
228
230
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
230
232
logMessage ( newMessage , true ) ; // log the message to console
231
233
processMessage ( newMessage , true ) ; // and process it normally
232
234
} ) ;
You can’t perform that action at this time.
0 commit comments