Merge pull request 'Fix logs debug twitch' (#15) from fix/twitch-notif into develop
Reviewed-on: #15
This commit is contained in:
@@ -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}`
|
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)
|
await connect(mongo_url).catch(console.error)
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "development") await twitchClient.eventSub.deleteAllSubscriptions()
|
|
||||||
const streamerIds: string[] = []
|
const streamerIds: string[] = []
|
||||||
|
|
||||||
await Promise.all(client.guilds.cache.map(async guild => {
|
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 }
|
if (!user) { logConsole('twitch', 'ready.user_not_found', { guild: guild.name, userId: streamer.twitchUserId }); return }
|
||||||
|
|
||||||
const userSubs = await twitchClient.eventSub.getSubscriptionsForUser(streamer.twitchUserId)
|
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")) {
|
if (!userSubs.data.find(sub => sub.transportMethod === "webhook" && sub.type === "stream.online")) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
listener.onStreamOnline(streamer.twitchUserId, onlineSub)
|
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 })
|
logConsole('twitch', 'ready.stream_offline_cleanup', { guild: guild.name, userName: user.name })
|
||||||
await cleanupMessageId(guildProfile, streamer.twitchUserId)
|
await cleanupMessageId(guildProfile, streamer.twitchUserId)
|
||||||
}
|
}
|
||||||
|
|
||||||
logConsole('twitch', 'user_operational', { name: user.name, id: streamer.twitchUserId })
|
|
||||||
}))
|
}))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user