Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Commit

Permalink
Increase high water mark and fix query string.
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanFleck committed Mar 17, 2021
1 parent 2227979 commit 0389bf0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 150 deletions.
5 changes: 1 addition & 4 deletions commands/crypto.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Message } from "discord.js";
import { Command, CommandDefinition, Action } from ".";
import dotenv from "dotenv";
import fetch from "node-fetch";

dotenv.config();

export const description: CommandDefinition = {
name: "Crypto Watcher",
description:
Expand All @@ -14,7 +11,7 @@ export const description: CommandDefinition = {
};

export const action: Action = async (message: Message): Promise<any> => {
const symbol = message.content.replace("!crypto ", "").toUpperCase();
const symbol = message.content.replace("!crypto ", "").toLowerCase();
if (symbol === "") {
message.channel.send(
"I don't see a symbol... For example, you can do `!crypto BASE-TARGET`, i.e. `!crypto btc-usd`"
Expand Down
6 changes: 4 additions & 2 deletions commands/music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const playSong = async (
console.log(`Streaming ${url} to ${message.author.tag}`);
const dispatch = x
.play(
await ytdl(url, { filter: "audioonly", highWaterMark: 1 << 50 }),
await ytdl(url, { filter: "audioonly", highWaterMark: 1 << 100 }),
{ type: "opus", highWaterMark: 1 }
)
.on("finish", () => {
Expand Down Expand Up @@ -91,7 +91,7 @@ export const action: Action = async (
);
return;
}
const input: string = message.content.split(" ").splice(1).join(" ").trim();
const input: string = message.content.split(" ").splice(1).join("+").trim();

if (validateURL(input)) {
return playSong(input, voiceChannel, message);
Expand All @@ -104,6 +104,8 @@ export const action: Action = async (
// Scrape for the title
// https://iq.opengenus.org/scrapping-youtube-javascript/
const query: string = input.replace(" ", "+");

console.log(`INPUT QUERY: ${query}`);
// puppeteer on heroku: https://stackoverflow.com/a/52228855
return puppeteer
.launch({ args: ["--no-sandbox", "--disable-setuid-sandbox"] })
Expand Down
154 changes: 12 additions & 142 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "ISC",
"devDependencies": {
"@types/express": "^4.17.11",
"@types/node": "^14.14.20",
"@types/node": "^14.14.35",
"@types/node-fetch": "^2.5.8",
"nodemon": "^2.0.7",
"npm-run-all": "^4.1.5",
Expand All @@ -37,7 +37,7 @@
"dotenv": "^8.2.0",
"express": "^4.17.1",
"ffmpeg": "0.0.4",
"ffmpeg-static": "^4.2.7",
"ffmpeg-static": "^4.2.8",
"fluent-ffmpeg": "^2.1.2",
"ibm-watson": "^6.0.2",
"node-fetch": "^2.6.1",
Expand Down

0 comments on commit 0389bf0

Please sign in to comment.