-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'verified-bot-edition-dev' of github.com:Member-Counter/…
…bot into verified-bot-edition-dev
- Loading branch information
Showing
27 changed files
with
232 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env node | ||
console.log("Updating from 0.18.6 to 0.18.7..."); | ||
require("dotenv").config(); | ||
const { MongoClient } = require("mongodb"); | ||
|
||
const { DB_URI } = process.env; | ||
|
||
(async () => { | ||
const mongoClient = await MongoClient.connect(DB_URI, { | ||
useUnifiedTopology: true | ||
}); | ||
const db = mongoClient.db(); | ||
|
||
// Guild Count cache | ||
const guildCountCacheCollection = db.collection("guildcountcaches"); | ||
const guildCountCacheCollectionSize = await guildCountCacheCollection.countDocuments(); | ||
|
||
const guildCountCacheCursor = guildCountCacheCollection.find(); | ||
|
||
let guildCountCachesProcessed = 0; | ||
while ( | ||
(await guildCountCacheCursor.hasNext()) && | ||
guildCountCachesProcessed < guildCountCacheCollectionSize | ||
) { | ||
const cachedCount = await guildCountCacheCursor.next(); | ||
|
||
cachedCount.timestamp = new Date(cachedCount.timestamp); | ||
|
||
delete cachedCount._id; | ||
delete cachedCount.__v; | ||
|
||
await guildCountCacheCollection | ||
.findOneAndUpdate({ id: cachedCount.id }, { $set: cachedCount }) | ||
.catch(console.error); | ||
|
||
guildCountCachesProcessed++; | ||
process.stdout.write( | ||
`\r[${guildCountCachesProcessed} of ${guildCountCacheCollectionSize}] Documents Processed (Guild Count cache)` | ||
); | ||
} | ||
|
||
process.stdout.write("\nDone\n"); | ||
process.exit(0); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.