fix some syntax and stuff
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { chatClient } from "../core/chat-client.ts";
|
||||
import type { ICommand, ICommandRequirements } from "./interface";
|
||||
import type { ICommand, ICommandRequirements } from "./interface.ts";
|
||||
|
||||
export abstract class BaseCommand implements ICommand {
|
||||
protected get chatClient() {
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
import type { ChatMessage } from "@twurple/chat";
|
||||
import { logSuccess } from "../util/logger.ts";
|
||||
import axios from "axios";
|
||||
import { logError, logSuccess } from "../util/logger.ts";
|
||||
import { BaseCommand } from "./base-command.ts";
|
||||
import type { ICommandRequirements } from "./interface.ts";
|
||||
|
||||
interface ISong {
|
||||
title: string;
|
||||
artists: string;
|
||||
album: string;
|
||||
playingFrom: string;
|
||||
status: "playing" | "paused";
|
||||
url: string;
|
||||
current: string;
|
||||
duration: string;
|
||||
}
|
||||
|
||||
export class SongCommand extends BaseCommand {
|
||||
name = "song";
|
||||
cooldown = 0;
|
||||
@@ -19,7 +31,24 @@ export class SongCommand extends BaseCommand {
|
||||
_text: string,
|
||||
_msg: ChatMessage,
|
||||
) => {
|
||||
logSuccess(`${channel} song command triggered`);
|
||||
logSuccess(`${channel} ${user} song command triggered`);
|
||||
logSuccess(await getSongFromTidal());
|
||||
// client.say(channel, "testing");
|
||||
};
|
||||
}
|
||||
|
||||
async function getSongFromTidal() {
|
||||
axios.get<ISong>("http://localhost:47836/current").then(
|
||||
(response) => {
|
||||
const currentSong = response.data;
|
||||
|
||||
const status = currentSong.status === "playing" ? "▶️" : "⏸️";
|
||||
|
||||
return `listening to ${currentSong.title} by ${currentSong.artists}. ${status} ${currentSong.current}/${currentSong.duration}. link: ${currentSong.url}`;
|
||||
},
|
||||
() => {
|
||||
logError("error getting song from tidal");
|
||||
return "";
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user