Skip to content

Commit

Permalink
fixed restart messages
Browse files Browse the repository at this point in the history
  • Loading branch information
GhomKrosmonaute committed Oct 3, 2023
1 parent f7a7da0 commit 50abfbd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/listeners/ready.restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const listener: app.Listener<"ready"> = {
event: "ready",
description: "Send restart messages",
once: true,
async run() {
async run(client) {
const restartMessages = await restart.query.select()

app.log("Restart messages: "+ restartMessages.length)

for (const restartMessage of restartMessages) {
const channel = this.channels.cache.get(restartMessage.last_channel_id)
const channel = client.channels.cache.get(restartMessage.last_channel_id)

if (channel?.isText()) {
const content = `${restartMessage.content} (${time
Expand All @@ -42,6 +44,11 @@ const listener: app.Listener<"ready"> = {
app.error(error, __filename)
}
}
} else {
app.error(
`channel ${restartMessage.last_channel_id} is not a text channel`,
__filename
)
}
}

Expand Down

0 comments on commit 50abfbd

Please sign in to comment.