fix build
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { chatClient } from "./core/client.ts";
|
import { chatClient } from "./core/client.js";
|
||||||
import { registerAllEvents } from "./events/registry.ts";
|
import { registerAllEvents } from "./events/registry.js";
|
||||||
|
|
||||||
registerAllEvents();
|
registerAllEvents();
|
||||||
chatClient.connect();
|
chatClient.connect();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { ChatUser } from "@twurple/chat";
|
import type { ChatUser } from "@twurple/chat";
|
||||||
import { Config } from "../config/config.ts";
|
import { Config } from "../config/config.js";
|
||||||
import { chatClient } from "../core/client.ts";
|
import { chatClient } from "../core/client.js";
|
||||||
import type { ICommand, ICommandRequirements } from "./interface.ts";
|
import type { ICommand, ICommandRequirements } from "./interface.js";
|
||||||
|
|
||||||
export abstract class BaseCommand implements ICommand {
|
export abstract class BaseCommand implements ICommand {
|
||||||
protected get chatClient() {
|
protected get chatClient() {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Collection } from "@discordjs/collection";
|
import { Collection } from "@discordjs/collection";
|
||||||
import { PingCommand } from "./impl/ping.ts";
|
import { PingCommand } from "./impl/ping.js";
|
||||||
import { PositionCommand } from "./impl/position.ts";
|
import { PositionCommand } from "./impl/position.js";
|
||||||
import { SongCommand } from "./impl/song.ts";
|
import { SongCommand } from "./impl/song.js";
|
||||||
import { TempCommand } from "./impl/temp.ts";
|
import { TempCommand } from "./impl/temp.js";
|
||||||
import { VanishCommand } from "./impl/vanish.ts";
|
import { VanishCommand } from "./impl/vanish.js";
|
||||||
import { VolumeCommand } from "./impl/volume.ts";
|
import { VolumeCommand } from "./impl/volume.js";
|
||||||
import { WhereCommand } from "./impl/where.ts";
|
import { WhereCommand } from "./impl/where.js";
|
||||||
import type { ICommand } from "./interface.ts";
|
import type { ICommand } from "./interface.js";
|
||||||
|
|
||||||
export const commands = new Collection<string, ICommand>();
|
export const commands = new Collection<string, ICommand>();
|
||||||
const cmds: Array<ICommand> = [];
|
const cmds: Array<ICommand> = [];
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { ChatMessage } from "@twurple/chat";
|
import type { ChatMessage } from "@twurple/chat";
|
||||||
import { calculateSecondsBetween } from "../../util/general.ts";
|
import { calculateSecondsBetween } from "../../util/general.js";
|
||||||
import { logSuccess } from "../../util/logger.ts";
|
import { logSuccess } from "../../util/logger.js";
|
||||||
import { BaseCommand } from "../base-command.ts";
|
import { BaseCommand } from "../base-command.js";
|
||||||
import type { ICommandRequirements } from "../interface.ts";
|
import type { ICommandRequirements } from "../interface.js";
|
||||||
|
|
||||||
export class PingCommand extends BaseCommand {
|
export class PingCommand extends BaseCommand {
|
||||||
started: number;
|
started: number;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { ChatMessage } from "@twurple/chat";
|
import type { ChatMessage } from "@twurple/chat";
|
||||||
import { getDeskPositionText } from "../../util/api-homeassistant.ts";
|
import { getDeskPositionText } from "../../util/api-homeassistant.js";
|
||||||
import { calculateSecondsBetween } from "../../util/general.ts";
|
import { calculateSecondsBetween } from "../../util/general.js";
|
||||||
import { logSuccess } from "../../util/logger.ts";
|
import { logSuccess } from "../../util/logger.js";
|
||||||
import { BaseCommand } from "../base-command.ts";
|
import { BaseCommand } from "../base-command.js";
|
||||||
import type { ICommandRequirements } from "../interface.ts";
|
import type { ICommandRequirements } from "../interface.ts";
|
||||||
|
|
||||||
export class PositionCommand extends BaseCommand {
|
export class PositionCommand extends BaseCommand {
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import type { ChatMessage } from "@twurple/chat";
|
import type { ChatMessage } from "@twurple/chat";
|
||||||
import { getSongFromTidalFormatted } from "../../util/api-tidal.ts";
|
import { getSongFromTidalFormatted } from "../../util/api-tidal.js";
|
||||||
import { logSuccess } from "../../util/logger.ts";
|
import { logSuccess } from "../../util/logger.js";
|
||||||
import { BaseCommand } from "../base-command.ts";
|
import { BaseCommand } from "../base-command.js";
|
||||||
import type { ICommandRequirements } from "../interface.ts";
|
|
||||||
|
import type { ICommandRequirements } from "../interface.js";
|
||||||
|
|
||||||
export class SongCommand extends BaseCommand {
|
export class SongCommand extends BaseCommand {
|
||||||
name = "song";
|
name = "song";
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { ChatMessage } from "@twurple/chat";
|
import type { ChatMessage } from "@twurple/chat";
|
||||||
import { getTemperatures } from "../../util/api-homeassistant.ts";
|
import { getTemperatures } from "../../util/api-homeassistant.js";
|
||||||
import { logSuccess } from "../../util/logger.ts";
|
import { logSuccess } from "../../util/logger.js";
|
||||||
import { BaseCommand } from "../base-command.ts";
|
import { BaseCommand } from "../base-command.js";
|
||||||
import type { ICommandRequirements } from "../interface.ts";
|
import type { ICommandRequirements } from "../interface.js";
|
||||||
|
|
||||||
export class TempCommand extends BaseCommand {
|
export class TempCommand extends BaseCommand {
|
||||||
name = "temp";
|
name = "temp";
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { ChatMessage } from "@twurple/chat";
|
import type { ChatMessage } from "@twurple/chat";
|
||||||
import { purgeByIds } from "../../util/api-functions.ts";
|
import { purgeByIds } from "../../util/api-functions.js";
|
||||||
import { logSuccess } from "../../util/logger.ts";
|
import { logSuccess } from "../../util/logger.js";
|
||||||
import { BaseCommand } from "../base-command.ts";
|
import { BaseCommand } from "../base-command.js";
|
||||||
import type { ICommandRequirements } from "../interface.ts";
|
import type { ICommandRequirements } from "../interface.js";
|
||||||
|
|
||||||
export class VanishCommand extends BaseCommand {
|
export class VanishCommand extends BaseCommand {
|
||||||
name = "v";
|
name = "v";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { ChatMessage, ChatUser } from "@twurple/chat";
|
import type { ChatMessage, ChatUser } from "@twurple/chat";
|
||||||
import { Config } from "../../config/config.ts";
|
import { Config } from "../../config/config.js";
|
||||||
import { getVolumeFromTidal, setVolumeToTidal } from "../../util/api-tidal.ts";
|
import { getVolumeFromTidal, setVolumeToTidal } from "../../util/api-tidal.js";
|
||||||
import { logSuccess } from "../../util/logger.ts";
|
import { logSuccess } from "../../util/logger.js";
|
||||||
import { BaseCommand } from "../base-command.ts";
|
import { BaseCommand } from "../base-command.js";
|
||||||
import type { ICommand, ICommandRequirements } from "../interface.ts";
|
import type { ICommand, ICommandRequirements } from "../interface.js";
|
||||||
|
|
||||||
export class VolumeCommand extends BaseCommand {
|
export class VolumeCommand extends BaseCommand {
|
||||||
name = "vol";
|
name = "vol";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { ChatMessage } from "@twurple/chat";
|
import type { ChatMessage } from "@twurple/chat";
|
||||||
import { logSuccess } from "../../util/logger.ts";
|
import { logSuccess } from "../../util/logger.js";
|
||||||
import { BaseCommand } from "../base-command.ts";
|
import { BaseCommand } from "../base-command.js";
|
||||||
import type { ICommandRequirements } from "../interface.ts";
|
import type { ICommandRequirements } from "../interface.js";
|
||||||
|
|
||||||
export class WhereCommand extends BaseCommand {
|
export class WhereCommand extends BaseCommand {
|
||||||
name = "where";
|
name = "where";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ApiClient } from "@twurple/api";
|
import { ApiClient } from "@twurple/api";
|
||||||
import { type AccessToken, RefreshingAuthProvider } from "@twurple/auth";
|
import { type AccessToken, RefreshingAuthProvider } from "@twurple/auth";
|
||||||
import { ChatClient } from "@twurple/chat";
|
import { ChatClient } from "@twurple/chat";
|
||||||
import { Config } from "../config/config.ts";
|
import { Config } from "../config/config.js";
|
||||||
import { logError } from "../util/logger.ts";
|
import { logError } from "../util/logger.js";
|
||||||
import { TokenManager } from "./token-manager.ts";
|
import { TokenManager } from "./token-manager.js";
|
||||||
|
|
||||||
const tokenManager = new TokenManager(Config.bot_user_id);
|
const tokenManager = new TokenManager(Config.bot_user_id);
|
||||||
const tokenData = await tokenManager.getToken();
|
const tokenData = await tokenManager.getToken();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { promises as fs } from "node:fs";
|
import { promises as fs } from "node:fs";
|
||||||
import type { AccessToken } from "@twurple/auth";
|
import type { AccessToken } from "@twurple/auth";
|
||||||
import { logError, logInfo } from "../util/logger.ts";
|
import { logError, logInfo } from "../util/logger.js";
|
||||||
|
|
||||||
export class TokenManager {
|
export class TokenManager {
|
||||||
private readonly tokenFilePath: string;
|
private readonly tokenFilePath: string;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { chatClient } from "../core/client.ts";
|
import { chatClient } from "../core/client.js";
|
||||||
import type { IEvent } from "./interface.ts";
|
import type { IEvent } from "./interface.js";
|
||||||
import type { EventName } from "./registry.ts";
|
import type { EventName } from "./registry.js";
|
||||||
|
|
||||||
export abstract class BaseEvent implements IEvent {
|
export abstract class BaseEvent implements IEvent {
|
||||||
protected get chatClient() {
|
protected get chatClient() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { logSuccess } from "../../util/logger.ts";
|
import { logSuccess } from "../../util/logger.js";
|
||||||
import { BaseEvent } from "../base-event.ts";
|
import { BaseEvent } from "../base-event.js";
|
||||||
import type { EventName } from "../registry.ts";
|
import type { EventName } from "../registry.js";
|
||||||
|
|
||||||
export default class ConnectedEvent extends BaseEvent {
|
export default class ConnectedEvent extends BaseEvent {
|
||||||
name: EventName = "connected";
|
name: EventName = "connected";
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Collection } from "@discordjs/collection";
|
import { Collection } from "@discordjs/collection";
|
||||||
import type { ChatMessage } from "@twurple/chat";
|
import type { ChatMessage } from "@twurple/chat";
|
||||||
import { commands } from "../../commands/collection.ts";
|
import { commands } from "../../commands/collection.js";
|
||||||
import type { ICommand } from "../../commands/interface.ts";
|
import type { ICommand } from "../../commands/interface.js";
|
||||||
import { Config } from "../../config/config.ts";
|
import { Config } from "../../config/config.js";
|
||||||
import { BaseEvent } from "../base-event.ts";
|
import { BaseEvent } from "../base-event.js";
|
||||||
import type { EventName } from "../registry.ts";
|
import type { EventName } from "../registry.js";
|
||||||
|
|
||||||
const Cooldowns = new Collection<string, number>();
|
const Cooldowns = new Collection<string, number>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { EventName } from "./registry.ts";
|
import type { EventName } from "./registry.js";
|
||||||
|
|
||||||
export interface IEvent {
|
export interface IEvent {
|
||||||
name: EventName;
|
name: EventName;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { chatClient } from "../core/client.ts";
|
import { chatClient } from "../core/client.js";
|
||||||
import { logInfo } from "../util/logger.ts";
|
import { logInfo } from "../util/logger.js";
|
||||||
import ConnectedEvent from "./impl/connected.ts";
|
import ConnectedEvent from "./impl/connected.js";
|
||||||
import MessageEvent from "./impl/message.ts";
|
import MessageEvent from "./impl/message.js";
|
||||||
import type { IEvent } from "./interface.ts";
|
import type { IEvent } from "./interface.js";
|
||||||
|
|
||||||
export const eventRegistry = {
|
export const eventRegistry = {
|
||||||
message: (handler: IEvent) => chatClient.onMessage(handler.triggered),
|
message: (handler: IEvent) => chatClient.onMessage(handler.triggered),
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { exchangeCode } from "@twurple/auth";
|
import { exchangeCode } from "@twurple/auth";
|
||||||
import { Config } from "../config/config.ts";
|
import { Config } from "../config/config.js";
|
||||||
import { TokenManager } from "../core/token-manager.ts";
|
import { TokenManager } from "../core/token-manager.js";
|
||||||
import { TwitchAuth } from "../util/auth.ts";
|
import { TwitchAuth } from "../util/auth.js";
|
||||||
import { logInfo } from "../util/logger.ts";
|
import { logInfo } from "../util/logger.js";
|
||||||
|
|
||||||
const port = 3000;
|
const port = 3000;
|
||||||
const redirectUri = `http://localhost:${port}`;
|
const redirectUri = `http://localhost:${port}`;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ApiClient } from "@twurple/api";
|
import { ApiClient } from "@twurple/api";
|
||||||
import { AppTokenAuthProvider } from "@twurple/auth";
|
import { AppTokenAuthProvider } from "@twurple/auth";
|
||||||
import { Config } from "../config/config.ts";
|
import { Config } from "../config/config.js";
|
||||||
|
|
||||||
const authProvider = new AppTokenAuthProvider(
|
const authProvider = new AppTokenAuthProvider(
|
||||||
Config.client_id,
|
Config.client_id,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { promptForInput } from "../util/general.ts";
|
import { promptForInput } from "../util/general.js";
|
||||||
import { logError, logSuccess, logWarning } from "../util/logger.ts";
|
import { logError, logSuccess, logWarning } from "../util/logger.js";
|
||||||
import { setupClient } from "./setup-client.ts";
|
import { setupClient } from "./setup-client.js";
|
||||||
|
|
||||||
const botname = await promptForInput("enter bot username: ");
|
const botname = await promptForInput("enter bot username: ");
|
||||||
const developers = (
|
const developers = (
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { UserIdResolvable } from "@twurple/api";
|
import type { UserIdResolvable } from "@twurple/api";
|
||||||
import { Config } from "../config/config.ts";
|
import { Config } from "../config/config.js";
|
||||||
import { apiClient } from "../core/client.ts";
|
import { apiClient } from "../core/client.js";
|
||||||
import { getUserId } from "./general.ts";
|
import { getUserId } from "./general.js";
|
||||||
import { logError } from "./logger.ts";
|
import { logError } from "./logger.js";
|
||||||
|
|
||||||
export async function banByIds(
|
export async function banByIds(
|
||||||
channelId: UserIdResolvable,
|
channelId: UserIdResolvable,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { Config } from "../config/config.ts";
|
import { Config } from "../config/config.js";
|
||||||
import { logWarning } from "./logger.ts";
|
import { logWarning } from "./logger.js";
|
||||||
|
|
||||||
type HomeAssistantEntity = {
|
type HomeAssistantEntity = {
|
||||||
entity_id: string;
|
entity_id: string;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { Config } from "../config/config.ts";
|
import { Config } from "../config/config.js";
|
||||||
import { logWarning } from "./logger.ts";
|
import { logWarning } from "./logger.js";
|
||||||
|
|
||||||
type Song = {
|
type Song = {
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import {
|
|||||||
type ServerResponse,
|
type ServerResponse,
|
||||||
} from "node:http";
|
} from "node:http";
|
||||||
import { URL } from "node:url";
|
import { URL } from "node:url";
|
||||||
import { Config } from "../config/config.ts";
|
import { Config } from "../config/config.js";
|
||||||
import { logError, logInfo } from "./logger.ts";
|
import { logError, logInfo } from "./logger.js";
|
||||||
|
|
||||||
export class TwitchAuth {
|
export class TwitchAuth {
|
||||||
private readonly redirectUri: string;
|
private readonly redirectUri: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as readline from "node:readline";
|
import * as readline from "node:readline";
|
||||||
import type { UserIdResolvable } from "@twurple/api";
|
import type { UserIdResolvable } from "@twurple/api";
|
||||||
import { apiClient } from "../core/client.ts";
|
import { apiClient } from "../core/client.js";
|
||||||
import { logSuccess, logWarning } from "./logger.ts";
|
import { logSuccess, logWarning } from "./logger.js";
|
||||||
|
|
||||||
export async function getUserId(username: string): Promise<UserIdResolvable> {
|
export async function getUserId(username: string): Promise<UserIdResolvable> {
|
||||||
const user = await apiClient.users.getUserByName(username);
|
const user = await apiClient.users.getUserByName(username);
|
||||||
|
|||||||
@@ -12,12 +12,10 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"noEmit": true,
|
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": true,
|
||||||
"incremental": true
|
"incremental": true
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
|||||||
1
tsconfig.tsbuildinfo
Normal file
1
tsconfig.tsbuildinfo
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user