remove scraps
This commit is contained in:
parent
ce85bedc32
commit
981ece7f89
|
@ -0,0 +1,10 @@
|
|||
|
||||
|
||||
import { alert } from './src/sound.js'
|
||||
|
||||
async function main () {
|
||||
await alert()
|
||||
}
|
||||
|
||||
|
||||
main()
|
121
index.ts
121
index.ts
|
@ -214,93 +214,9 @@ async function registerRoomStatusListeners(appContext, rooms, cb, ably) {
|
|||
})
|
||||
|
||||
await realtimeClient.connect()
|
||||
|
||||
|
||||
|
||||
|
||||
// get the channel topic strings
|
||||
// const topicStrings =
|
||||
|
||||
// const roomStatusTopicString = this.pushServiceAuth.channels[`RoomStatusTopic#RoomStatusTopic:${this.id}`]
|
||||
|
||||
// const messageChannel = this.realtime.channels.get(roomMessageTopicString);
|
||||
// messageChannel.subscribe((message) => {
|
||||
// this.onMessage(message)
|
||||
// })
|
||||
|
||||
// realtimeClient.subscribe()
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
// async function registerRoomListeners(appContext, rooms, cb, ably) {
|
||||
// for (const room of rooms) {
|
||||
// const roomName = room.name;
|
||||
// const roomId = room.id;
|
||||
// appContext.logger.log({ level: 'info', message: `monitoring room:${roomName} (${roomId})` })
|
||||
|
||||
// // here we create a room instance
|
||||
// // this instance has callbacks for each type of
|
||||
// // channel message.
|
||||
// // @todo all channels are subscribed to
|
||||
// // at the time of instanciation.
|
||||
// // we need to change this so subscriptions happen
|
||||
// // on-demand.
|
||||
// // the only channel that is subscribed to at instantiation
|
||||
// // is status channel.
|
||||
// // if status channel is unavailable, try password channel.
|
||||
// // if no channels are available, we need to throw an err.
|
||||
// const rm = new Room(appContext, {
|
||||
// roomName: roomName,
|
||||
// roomId: roomId,
|
||||
// ably: ably,
|
||||
// cb: cb,
|
||||
// onStart: (m) => onCbStart(appContext, roomName, m),
|
||||
// onStop: (m) => onCbStop(appContext, roomName, m),
|
||||
// onMessage: (m) => onCbMessage(appContext, roomName, m),
|
||||
// onSilence: (m) => onCbSilence(appContext, roomName, m),
|
||||
// onTitle: (m) => onCbTitle(appContext, roomName, m),
|
||||
// onTip: (m) => onCbTip(appContext, roomName, m),
|
||||
// onPassword: (m) => onCbPassword(appContext, roomName, m),
|
||||
// })
|
||||
|
||||
// // retry if errors
|
||||
// let retry = true;
|
||||
// while (retry) {
|
||||
// try {
|
||||
// await rm.monitorRealtime();
|
||||
// retry = false; // If no error occurs, exit the loop
|
||||
// appContext.logger.log({ level: 'debug', message: 'monitorRealtime() completed without error.' })
|
||||
// } catch (e) {
|
||||
// appContext.logger.log({ level: 'info', message: `Error caught when attempting to monitor ${roomName} realtime. ${e}. Retrying.` });
|
||||
// const minTimeout = 5000; // 5 seconds in milliseconds
|
||||
// const maxTimeout = 15000; // 15 seconds in milliseconds
|
||||
// const timeout = Math.floor(Math.random() * (maxTimeout - minTimeout + 1)) + minTimeout;
|
||||
// appContext.logger.log({ level: 'info', message: `${timeout} courtesy timer before retry` })
|
||||
// await new Promise<void>((resolve) => setTimeout(() => resolve(), timeout));
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * These room timers are used to differentiate between stream ending, and temporary outages
|
||||
// * Room timers track how long a room has been offline.
|
||||
// * If the room has been offline for less than 5 minutes and a start event occurs, the offline event must have been a temporary outage.
|
||||
// */
|
||||
// function registerRoomTimers(appContext, rooms) {
|
||||
// for (const room of rooms) {
|
||||
// const roomName = room.name
|
||||
// appContext.logger.log({ level: 'debug', message: `registering room timer for ${roomName}` })
|
||||
// appContext.roomTimers[roomName] = {}
|
||||
// appContext.roomTimers[roomName].offline = null
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
async function daemon () {
|
||||
|
@ -337,11 +253,28 @@ async function daemon () {
|
|||
await registerRoomStatusListeners(appContext, rooms, chaturbateAuth, ably)
|
||||
|
||||
// console.log(`lets kick the webserver`)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the room's dossier
|
||||
*/
|
||||
async function dossier (roomName: string) {
|
||||
const appContext = await init()
|
||||
const r = new Room(appContext, {
|
||||
name: roomName
|
||||
})
|
||||
const doss = await r.getInitialRoomDossier()
|
||||
console.log(doss)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* exportLogs
|
||||
* export chat logs into a format suitable for publishing
|
||||
* @todo
|
||||
*/
|
||||
async function exportLogs (options) {
|
||||
const appContext = await init()
|
||||
|
||||
|
@ -378,6 +311,22 @@ yargs(hideBin(process.argv))
|
|||
daemon()
|
||||
}
|
||||
})
|
||||
.command({
|
||||
command: 'dossier',
|
||||
desc: `Get the room's dossier`,
|
||||
builder: (yargs) => {
|
||||
return yargs
|
||||
.option('room', {
|
||||
alias: 'r',
|
||||
describe: 'name of the CB room',
|
||||
required: true
|
||||
})
|
||||
},
|
||||
handler: (argv) => {
|
||||
console.info(argv)
|
||||
dossier(argv.room)
|
||||
}
|
||||
})
|
||||
.command({
|
||||
command: 'export',
|
||||
alias: 'e',
|
||||
|
|
12
src/Room.ts
12
src/Room.ts
|
@ -12,12 +12,12 @@ export interface IRoomOptions {
|
|||
chaturbateAuth?: any;
|
||||
ablyWrapper?: any;
|
||||
name: string;
|
||||
onStatus: any;
|
||||
onMessage: any;
|
||||
onSilence: any;
|
||||
onTitle: any;
|
||||
onTip: any;
|
||||
onPassword: any;
|
||||
onStatus?: any;
|
||||
onMessage?: any;
|
||||
onSilence?: any;
|
||||
onTitle?: any;
|
||||
onTip?: any;
|
||||
onPassword?: any;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"tid": "16873746703:39479",
|
||||
"ts": 1687374670.4058313,
|
||||
"amount": 111,
|
||||
"message": "",
|
||||
"history": true,
|
||||
"is_anonymous_tip": false,
|
||||
"to_username": "_keti_",
|
||||
"from_username": "affose",
|
||||
"gender": "m",
|
||||
"is_broadcaster": false,
|
||||
"in_fanclub": false,
|
||||
"is_following": false,
|
||||
"is_mod": false,
|
||||
"has_tokens": true,
|
||||
"tipped_recently": true,
|
||||
"tipped_alot_recently": true,
|
||||
"tipped_tons_recently": false,
|
||||
"method": "lazy",
|
||||
"pub_ts": 1687374670.4170263
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{ "RoomUserPresenceTopic#RoomUserPresenceTopic:7XHKH7V:M79SV5L": { "broadcaster_uid": "7XHKH7V", "user_uid": "M79SV5L" }, "UserMessageTopic#UserMessageTopic:M79SV5L": { "user_uid": "M79SV5L" }, "UserChatMediaOpenedTopic#UserChatMediaOpenedTopic:M79SV5L": { "user_uid": "M79SV5L" }, "UserChatMediaRemovedTopic#UserChatMediaRemovedTopic:M79SV5L": { "user_uid": "M79SV5L" }, "UserPmReadTopic#UserPmReadTopic:M79SV5L": { "user_uid": "M79SV5L" }, "UserIgnoreTopic#UserIgnoreTopic:M79SV5L": { "user_uid": "M79SV5L" }, "UserTokenUpdateTopic#UserTokenUpdateTopic:M79SV5L": { "user_uid": "M79SV5L" }, "RoomTipAlertTopic#RoomTipAlertTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomPurchaseTopic#RoomPurchaseTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomFanClubJoinedTopic#RoomFanClubJoinedTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomMessageTopic#RoomMessageTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "GlobalPushServiceBackendChangeTopic#GlobalPushServiceBackendChangeTopic": { }, "QualityUpdateTopic#QualityUpdateTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "UserColorUpdateTopic#UserColorUpdateTopic:M79SV5L": { "user_uid": "M79SV5L" }, "UserAlertTopic#UserAlertTopic:M79SV5L": { "user_uid": "M79SV5L" }, "RoomNoticeTopic#RoomNoticeTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomEnterLeaveTopic#RoomEnterLeaveTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomPasswordProtectedTopic#RoomPasswordProtectedTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomModeratorPromotedTopic#RoomModeratorPromotedTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomModeratorRevokedTopic#RoomModeratorRevokedTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomStatusTopic#RoomStatusTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomTitleChangeTopic#RoomTitleChangeTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomSilenceTopic#RoomSilenceTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomKickTopic#RoomKickTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomUpdateTopic#RoomUpdateTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomSettingsTopic#RoomSettingsTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "RoomUserNoticeTopic#RoomUserNoticeTopic:7XHKH7V:M79SV5L": { "broadcaster_uid": "7XHKH7V", "user_uid": "M79SV5L" }, "RoomUserPrivateStatusTopic#RoomUserPrivateStatusTopic:7XHKH7V:M79SV5L": { "broadcaster_uid": "7XHKH7V", "user_uid": "M79SV5L" }, "RoomUserHiddenCamStatusTopic#RoomUserHiddenCamStatusTopic:7XHKH7V:M79SV5L": { "broadcaster_uid": "7XHKH7V", "user_uid": "M79SV5L" }, "RoomLightBlueTopic#RoomLightBlueTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "GameUpdateTopic#GameUpdateTopic:7XHKH7V": { "broadcaster_uid": "7XHKH7V" }, "UserSMCWatchingTopic#UserSMCWatchingTopic:M79SV5L": { "user_uid": "M79SV5L" }, "UserNewsSeenTopic#UserNewsSeenTopic:M79SV5L": { "user_uid": "M79SV5L" }, "OfflineTipNotificationTopic#OfflineTipNotificationTopic:M79SV5L": { "user_uid": "M79SV5L" }, "UpdateOfflineTipNotificationTopic#UpdateOfflineTipNotificationTopic:M79SV5L": { "user_uid": "M79SV5L" } }
|
|
@ -1,41 +0,0 @@
|
|||
|
||||
|
||||
// chaturbate channel names are on left hand side
|
||||
// Ably channel names are on right hand side
|
||||
|
||||
{
|
||||
"channels": {
|
||||
"RoomUserPresenceTopic#RoomUserPresenceTopic:JQ2YJS5:M79SV5L": "room_user:presence:JQ2YJS5:M79SV5L:0",
|
||||
"UserMessageTopic#UserMessageTopic:M79SV5L": "user:message:M79SV5L",
|
||||
"UserChatMediaOpenedTopic#UserChatMediaOpenedTopic:M79SV5L": "user:chatmedia_open:M79SV5L",
|
||||
"UserChatMediaRemovedTopic#UserChatMediaRemovedTopic:M79SV5L": "user:chatmedia_remove:M79SV5L",
|
||||
"UserPmReadTopic#UserPmReadTopic:M79SV5L": "user:pm_read:M79SV5L",
|
||||
"UserIgnoreTopic#UserIgnoreTopic:M79SV5L": "user:ignore:M79SV5L",
|
||||
"UserTokenUpdateTopic#UserTokenUpdateTopic:M79SV5L": "user:token_update:M79SV5L",
|
||||
"RoomTipAlertTopic#RoomTipAlertTopic:JQ2YJS5": "room:tip_alert:JQ2YJS5",
|
||||
"RoomPurchaseTopic#RoomPurchaseTopic:JQ2YJS5": "room:purchase:JQ2YJS5",
|
||||
"RoomFanClubJoinedTopic#RoomFanClubJoinedTopic:JQ2YJS5": "room:fanclub:JQ2YJS5",
|
||||
"RoomMessageTopic#RoomMessageTopic:JQ2YJS5": "room:message:JQ2YJS5:0",
|
||||
"GlobalPushServiceBackendChangeTopic#GlobalPushServiceBackendChangeTopic": "global:push_service",
|
||||
"QualityUpdateTopic#QualityUpdateTopic:JQ2YJS5": "room:quality_update:JQ2YJS5",
|
||||
"UserColorUpdateTopic#UserColorUpdateTopic:M79SV5L": "user:color_update:M79SV5L",
|
||||
"UserAlertTopic#UserAlertTopic:M79SV5L": "user:alert:M79SV5L",
|
||||
"RoomNoticeTopic#RoomNoticeTopic:JQ2YJS5": "room:notice:JQ2YJS5",
|
||||
"RoomEnterLeaveTopic#RoomEnterLeaveTopic:JQ2YJS5": "room:enter_leave:JQ2YJS5",
|
||||
"RoomPasswordProtectedTopic#RoomPasswordProtectedTopic:JQ2YJS5": "room:password_protected:JQ2YJS5:0",
|
||||
"RoomModeratorPromotedTopic#RoomModeratorPromotedTopic:JQ2YJS5": "room:mod_promoted:JQ2YJS5",
|
||||
"RoomModeratorRevokedTopic#RoomModeratorRevokedTopic:JQ2YJS5": "room:mod_revoked:JQ2YJS5",
|
||||
"RoomStatusTopic#RoomStatusTopic:JQ2YJS5": "room:status:JQ2YJS5:0",
|
||||
"RoomTitleChangeTopic#RoomTitleChangeTopic:JQ2YJS5": "room:title_change:JQ2YJS5",
|
||||
"RoomSilenceTopic#RoomSilenceTopic:JQ2YJS5": "room:silence:JQ2YJS5",
|
||||
"RoomKickTopic#RoomKickTopic:JQ2YJS5": "room:kick:JQ2YJS5",
|
||||
"RoomUpdateTopic#RoomUpdateTopic:JQ2YJS5": "room:update:JQ2YJS5",
|
||||
"RoomSettingsTopic#RoomSettingsTopic:JQ2YJS5": "room:settings:JQ2YJS5",
|
||||
"RoomUserNoticeTopic#RoomUserNoticeTopic:JQ2YJS5:M79SV5L": "room_user:notice:JQ2YJS5:M79SV5L",
|
||||
"RoomUserPrivateStatusTopic#RoomUserPrivateStatusTopic:JQ2YJS5:M79SV5L": "room_user:private_status:JQ2YJS5:M79SV5L",
|
||||
"RoomUserHiddenCamStatusTopic#RoomUserHiddenCamStatusTopic:JQ2YJS5:M79SV5L": "room_user:status:JQ2YJS5:M79SV5L",
|
||||
"RoomLightBlueTopic#RoomLightBlueTopic:JQ2YJS5": "lightblue:notice:JQ2YJS5",
|
||||
"GameUpdateTopic#GameUpdateTopic:JQ2YJS5": "room:game_update:JQ2YJS5",
|
||||
"UserSMCWatchingTopic#UserSMCWatchingTopic:M79SV5L": "user:smc_watching:M79SV5L"
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue