import fetch from "node-fetch" ; import { Logger } from "nodecg-io-core" ; export class AHK { private readonly address : string ; public constructor ( private logger , host , port ) { this . address = `http://${ host }:${ port }` ; } public async testConnection ( ) { const response = await fetch ( `${ this . address }/nodecg-io` , { method : "GET" } ) ; return response . status === 404 ; } public async sendCommand ( command ) { try { await fetch ( `${ this . address }/send/${ command }` , { method : "GET" } ) ; } catch ( err ) { this . logger . error ( `Error while using the AHK Connector: ${ err }` ) ; } } }