mirror of
https://github.com/a-sync/game-server-watcher.git
synced 2026-08-04 19:25:08 -04:00
upgrade gsw to esnext module
* fix import extensions * set new module and resolution type * upd. gamedig dependency to node-gamedig#master
This commit is contained in:
34
package-lock.json
generated
34
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "game-server-watcher",
|
||||
"version": "2.5.1",
|
||||
"version": "3.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "game-server-watcher",
|
||||
"version": "2.5.1",
|
||||
"version": "3.0.0",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@commonify/lowdb": "^3.0.0",
|
||||
@@ -14,7 +14,7 @@
|
||||
"axios": "^1.6.0",
|
||||
"discord.js": "^14.13.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"gamedig": "^4.3.0",
|
||||
"gamedig": "github:gamedig/node-gamedig",
|
||||
"grammy": "^1.19.2",
|
||||
"mustache": "^4.2.0"
|
||||
},
|
||||
@@ -26,7 +26,7 @@
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
"node": ">=16.20.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bufferutil": "^4.0.8",
|
||||
@@ -2175,17 +2175,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/gamedig": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/gamedig/-/gamedig-4.3.1.tgz",
|
||||
"integrity": "sha512-et9Aq4wlD0cExXEO3r3LWiEEjOzsnG5l/0YSqza7FZLoJqunNT6DedkAXAdeOqAqStkRQahQiPFjx2WCg4SOtg==",
|
||||
"version": "4.1.0",
|
||||
"resolved": "git+ssh://git@github.com/gamedig/node-gamedig.git#82772e0c022db0e79eb5a9f2a4af9018c47cc41c",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cheerio": "^1.0.0-rc.10",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"gbxremote": "^0.2.1",
|
||||
"got": "^12.1.0",
|
||||
"got": "^13.0.0",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"long": "^5.2.0",
|
||||
"minimist": "^1.2.6",
|
||||
"punycode": "^2.1.1",
|
||||
"long": "^5.2.3",
|
||||
"minimist": "^1.2.8",
|
||||
"punycode": "^2.3.0",
|
||||
"seek-bzip": "^2.0.0",
|
||||
"varint": "^6.0.0"
|
||||
},
|
||||
@@ -2193,7 +2193,7 @@
|
||||
"gamedig": "bin/gamedig.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
"node": ">=16.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/gamedig/node_modules/iconv-lite": {
|
||||
@@ -2335,9 +2335,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/got": {
|
||||
"version": "12.6.1",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-12.6.1.tgz",
|
||||
"integrity": "sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==",
|
||||
"version": "13.0.0",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-13.0.0.tgz",
|
||||
"integrity": "sha512-XfBk1CxOOScDcMr9O1yKkNaQyy865NbYs+F7dr4H0LZMVgCj2Le59k6PqbNHoL5ToeaEQUYh6c6yMfVcc6SJxA==",
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^5.2.0",
|
||||
"@szmarczak/http-timer": "^5.0.1",
|
||||
@@ -2352,7 +2352,7 @@
|
||||
"responselike": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
"node": ">=16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/got?sponsor=1"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"name": "game-server-watcher",
|
||||
"version": "2.5.1",
|
||||
"version": "3.0.0",
|
||||
"description": "A simple discord/telegram/slack bot that can be hosted on a free service to monitor your game servers and players in style. 😎",
|
||||
"main": "src/server",
|
||||
"exports": "./dist/server.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "node ./dist/server.js",
|
||||
"dev": "nodemon -e ts --exec \"npx tsc --incremental && node ./dist/server.js || exit 1\"",
|
||||
@@ -28,7 +29,7 @@
|
||||
"axios": "^1.6.0",
|
||||
"discord.js": "^14.13.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"gamedig": "^4.3.0",
|
||||
"gamedig": "github:gamedig/node-gamedig",
|
||||
"grammy": "^1.19.2",
|
||||
"mustache": "^4.2.0"
|
||||
},
|
||||
@@ -40,7 +41,7 @@
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
"node": ">=16.20.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bufferutil": "^4.0.8",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Client, GatewayIntentBits, TextChannel, Message, EmbedBuilder, APIEmbedField, HexColorString } from 'discord.js';
|
||||
import { Low, JSONFile } from '@commonify/lowdb';
|
||||
import { GameServer } from './game-server';
|
||||
import hhmmss from './lib/hhmmss';
|
||||
import { DiscordConfig } from './watcher';
|
||||
import { GameServer } from './game-server.js';
|
||||
import hhmmss from './lib/hhmmss.js';
|
||||
import { DiscordConfig } from './watcher.js';
|
||||
|
||||
const DATA_PATH = process.env.DATA_PATH || './data/';
|
||||
const DBG = Boolean(Number(process.env.DBG));
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import axios from 'axios';
|
||||
import { Player, query, QueryResult, Type } from 'gamedig';
|
||||
// @ts-ignore
|
||||
import { GameDig, Player, QueryResult, Type } from 'gamedig';
|
||||
import { Low, JSONFile } from '@commonify/lowdb';
|
||||
import ipRegex from './lib/ipregex';
|
||||
import getIP from './lib/getip';
|
||||
import { GameServerConfig } from './watcher';
|
||||
import ipRegex from './lib/ipregex.js';
|
||||
import getIP from './lib/getip.js';
|
||||
import { GameServerConfig } from './watcher.js';
|
||||
|
||||
const STEAM_WEB_API_KEY = process.env.STEAM_WEB_API_KEY || '';
|
||||
const DATA_PATH = process.env.DATA_PATH || './data/';
|
||||
@@ -52,7 +53,7 @@ export interface QueryOptions {
|
||||
type: Type;
|
||||
host: string;
|
||||
port: number;
|
||||
maxAttempts?: number;
|
||||
maxRetries?: number;
|
||||
socketTimeout?: number;
|
||||
attemptTimeout?: number;
|
||||
givenPortOnly?: boolean;
|
||||
@@ -118,7 +119,7 @@ export class GameServer {
|
||||
|
||||
async gamedig(): Promise<Info | null> {
|
||||
try {
|
||||
const res = await query({
|
||||
const res = await GameDig.query({
|
||||
type: this.config.type,
|
||||
host: this.config.host,
|
||||
port: this.config.port,
|
||||
|
||||
@@ -5,7 +5,11 @@ import { createServer } from 'node:http';
|
||||
import { URL } from 'node:url';
|
||||
import { getInstance } from 'gamedig';
|
||||
import 'dotenv/config';
|
||||
import { GameServerConfig, main, readConfig, updateConfig } from './watcher';
|
||||
import { GameServerConfig, main, readConfig, updateConfig } from './watcher.js';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const gamedigPjson = fs.readFileSync(path.resolve(__dirname, '../node_modules/gamedig/package.json'), 'utf-8');
|
||||
const gamedigVersion = JSON.parse(gamedigPjson).version || 0;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { App, Block, KnownBlock, LogLevel, MrkdwnElement, PlainTextElement } from '@slack/bolt';
|
||||
import { App as AppType, Block, KnownBlock, MrkdwnElement, PlainTextElement } from '@slack/bolt';
|
||||
import slack_pkg from '@slack/bolt';
|
||||
const { App, LogLevel } = slack_pkg;
|
||||
import { Low, JSONFile } from '@commonify/lowdb';
|
||||
import { GameServer } from './game-server';
|
||||
import hhmmss from './lib/hhmmss';
|
||||
import { SlackConfig } from './watcher';
|
||||
import { GameServer } from './game-server.js';
|
||||
import hhmmss from './lib/hhmmss.js';
|
||||
import { SlackConfig } from './watcher.js';
|
||||
|
||||
const DATA_PATH = process.env.DATA_PATH || './data/';
|
||||
const DBG = Boolean(Number(process.env.DBG));
|
||||
@@ -19,7 +21,7 @@ const db = new Low<SlackData[]>(adapter);
|
||||
|
||||
const serverInfoMessages: ServerInfoMessage[] = [];
|
||||
|
||||
let bot: App;
|
||||
let bot: AppType;
|
||||
export async function init(token: string, appToken: string) {
|
||||
if (!bot) {
|
||||
console.log('slack-bot starting...');
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Bot } from 'grammy';
|
||||
import { Low, JSONFile } from '@commonify/lowdb';
|
||||
import { GameServer } from './game-server';
|
||||
import hhmmss from './lib/hhmmss';
|
||||
import { TelegramConfig } from './watcher';
|
||||
import { GameServer } from './game-server.js';
|
||||
import hhmmss from './lib/hhmmss.js';
|
||||
import { TelegramConfig } from './watcher.js';
|
||||
|
||||
const DATA_PATH = process.env.DATA_PATH || './data/';
|
||||
const DBG = Boolean(Number(process.env.DBG));
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Type } from 'gamedig';
|
||||
import { Low, JSONFile } from '@commonify/lowdb';
|
||||
import { GameServer, initDb, saveDb } from './game-server';
|
||||
import * as discordBot from './discord-bot';
|
||||
import * as telegramBot from './telegram-bot';
|
||||
import * as slackBot from './slack-bot';
|
||||
import { GameServer, initDb, saveDb } from './game-server.js';
|
||||
import * as discordBot from './discord-bot.js';
|
||||
import * as telegramBot from './telegram-bot.js';
|
||||
import * as slackBot from './slack-bot.js';
|
||||
|
||||
const REFRESH_TIME_MINUTES = parseInt(process.env.REFRESH_TIME_MINUTES || '2', 10);
|
||||
const DISCORD_BOT_TOKEN = process.env.DISCORD_BOT_TOKEN || '';
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
"lib": [
|
||||
"es2020"
|
||||
],
|
||||
"module": "commonjs",
|
||||
"module": "esnext",
|
||||
"target": "es2019",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"resolveJsonModule" : true
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
|
||||
Reference in New Issue
Block a user