Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
uetchy committed Sep 9, 2021
1 parent f1efc3c commit ce5fbc0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
"lib"
],
"dependencies": {
"epicfail": "^2.0.0",
"masterchat": "^0.8.0",
"epicfail": "^3.0.0",
"masterchat": "^0.9.0",
"vm2": "^3.9.3"
},
"devDependencies": {
"@types/jest": "^27.0.1",
"@types/node": "^16.7.6",
"@types/node": "^16.9.0",
"execa": "^5.1.1",
"husky": "^7.0.2",
"jest": "^27.1.0",
"prettier": "^2.3.2",
"jest": "^27.1.1",
"prettier": "^2.4.0",
"pretty-quick": "^3.1.1",
"shx": "^0.3.3",
"ts-jest": "^27.0.5",
Expand All @@ -52,6 +52,6 @@
"youtube"
],
"engines": {
"node": ">= 12.18.3"
"node": ">= 14"
}
}
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import yargs from "yargs";
import { inspectChat } from "./commands/liveChat";
import epicfail from "epicfail";
import { epicfail } from "epicfail";

epicfail();
epicfail(require.main?.filename!);

const argv = yargs(process.argv.slice(2))
.scriptName("masterchat")
Expand Down
22 changes: 6 additions & 16 deletions src/commands/liveChat.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import chalk from "chalk";
import { Action, Masterchat, normalizeVideoId, runsToString } from "masterchat";
import fs from "node:fs";
import {
Action,
convertRunsToString,
Masterchat,
normalizeVideoId,
} from "masterchat";
import { VM, VMScript } from "vm2";

export function stringifyActions(
Expand All @@ -28,7 +23,7 @@ export function stringifyActions(
}

text += action.rawMessage
? convertRunsToString(action.rawMessage)
? runsToString(action.rawMessage)
: "<empty message>";

text += ` (${action.superchat.amount} ${action.superchat.currency})`;
Expand Down Expand Up @@ -64,7 +59,7 @@ export function stringifyActions(
text += ": ";
}

text += convertRunsToString(action.rawMessage);
text += runsToString(action.rawMessage);

simpleChat.push(text);
break;
Expand Down Expand Up @@ -129,7 +124,7 @@ export async function inspectChat(argv: any) {
// get web player context
const mc = await Masterchat.init(videoId);

console.log("title:", mc.metadata.title);
console.log("title:", mc.title);

let chatQueue: string[] = [];
let wait = 0;
Expand All @@ -145,12 +140,7 @@ export async function inspectChat(argv: any) {
}
});

for await (const response of mc.iterateChat(type)) {
if (response.error) {
const { error } = response;
console.log(`Error(${error.status}): ${error.message}`);
break;
}
for await (const response of mc.iterate({ topChat: type === "top" })) {
const { actions, continuation } = response;
const delay = continuation?.timeoutMs || 0;

Expand All @@ -177,7 +167,7 @@ export async function inspectChat(argv: any) {
isSuperchat: action.type === "addSuperChatItemAction",
message:
"rawMessage" in action && action.rawMessage
? convertRunsToString(action.rawMessage)
? runsToString(action.rawMessage)
: "",
};
return filter(filterContext);
Expand Down

0 comments on commit ce5fbc0

Please sign in to comment.