diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 13:45:44 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 13:45:44 -0400 |
commit | 81d69f983983ac71dbdbd5f13e2f2d8ddc35dced (patch) | |
tree | 6a06124a6696bb4036607d179972aa889b7b3769 /src/listeners/client | |
parent | 93e8fce44ec1dd3294b1c785d93d3f8b00ee4cef (diff) | |
download | tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.tar.gz tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.tar.bz2 tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.zip |
cleaning up and some imporvements to the stats command
Diffstat (limited to 'src/listeners/client')
-rw-r--r-- | src/listeners/client/ready.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/listeners/client/ready.ts b/src/listeners/client/ready.ts index cf616ce..fc71bb9 100644 --- a/src/listeners/client/ready.ts +++ b/src/listeners/client/ready.ts @@ -1,4 +1,4 @@ -import { BushListener } from '@lib'; +import { BushListener, Guild } from '@lib'; import chalk from 'chalk'; export default class ReadyListener extends BushListener { @@ -23,5 +23,13 @@ export default class ReadyListener extends BushListener { }` ) ); + + const guilds = await Guild.findAll(); + const needToCreate = []; + for (const [, guild] of client.guilds.cache) { + const find = guilds.find((g) => guild.id === g.id); + if (!find) needToCreate.push(guild.id); + } + await Guild.bulkCreate(needToCreate.map((id) => ({ id }))); } } |