Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/events/ChannelSyncService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Accomplice from '../accomplice'
import EventHandle from '../types/EventHandle'
import { Guild } from '../sequelize/types/guild'

export default class ChannelRecoverySyncService implements EventHandle {
public name = 'Channel Recovery Sync Service'
public description =
'Syncs the channel activity status with the database every 5 minutes'
public trigger = 'ready'
public fireOnce = true

public execute = async ({ bot }: { bot: Accomplice }): Promise<void> => {
// For each guild, check channel sync state on database
const { Guild } = bot.sequelize.models

const guilds: Guild[] = await Guild.findAll()

for (const guild of guilds) {
console.log('====', guild.channelsState, '====')
// const channelState = JSON.parse(guild.channelsState)
}
}
}