Compare commits

...

3 Commits

View File

@@ -27,7 +27,6 @@ export async function execute(client: Client) {
const mongo_url = `mongodb://${process.env.MONGOOSE_USER}:${process.env.MONGOOSE_PASSWORD}@${process.env.MONGOOSE_HOST}/${process.env.MONGOOSE_DATABASE}`
await connect(mongo_url).catch(console.error)
if (process.env.NODE_ENV === "development") await twitchClient.eventSub.deleteAllSubscriptions()
const streamerIds: string[] = []
await Promise.all(client.guilds.cache.map(async guild => {
@@ -71,6 +70,10 @@ export async function execute(client: Client) {
if (!user) { logConsole('twitch', 'ready.user_not_found', { guild: guild.name, userId: streamer.twitchUserId }); return }
const userSubs = await twitchClient.eventSub.getSubscriptionsForUser(streamer.twitchUserId)
if (process.env.NODE_ENV === "development") {
console.log(userSubs)
userSubs.data.forEach(sub => { console.log(sub) })
}
if (!userSubs.data.find(sub => sub.transportMethod === "webhook" && sub.type === "stream.online")) {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
listener.onStreamOnline(streamer.twitchUserId, onlineSub)
@@ -106,8 +109,6 @@ export async function execute(client: Client) {
logConsole('twitch', 'ready.stream_offline_cleanup', { guild: guild.name, userName: user.name })
await cleanupMessageId(guildProfile, streamer.twitchUserId)
}
logConsole('twitch', 'user_operational', { name: user.name, id: streamer.twitchUserId })
}))
}))