Skip to content

Commit d9a924d

Browse files
Techbot121Meta Construct
authored andcommitted
use execCommand instead
1 parent 5406c09 commit d9a924d

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

app/services/discord/modules/commands/developer/Gserv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const SlashGservCommand: SlashCommand = {
7272
try {
7373
let buffer = "";
7474

75-
await gameServer.sshExec("gserv", [command], {
75+
await gameServer.sshExecCommand("gserv " + command, {
7676
stream: "stderr",
7777
onStdout: buff => (buffer += buff),
7878
onStderr: buff => (buffer += buff),

app/services/discord/modules/webhook-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export default async (bot: DiscordBot): Promise<void> => {
157157
await Promise.all(
158158
where.map(async server => {
159159
await server
160-
.sshExec("gserv", ["qu", "rehash"], {
160+
.sshExecCommand("gserv qu rehash", {
161161
stream: "stderr",
162162
})
163163
.then(async () =>
@@ -204,7 +204,7 @@ export default async (bot: DiscordBot): Promise<void> => {
204204
const reply = await ctx.fetchReply();
205205

206206
await server
207-
.sshExec("gserv", ["qu", "rehash"], {
207+
.sshExecCommand("gserv qu rehash", {
208208
stream: "stderr",
209209
})
210210
.then(async () => {

app/services/gamebridge/GameServer.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,7 @@ export default class GameServer {
154154
return this.bridge.payloads["RconPayload"].callLua(code, realm, this, runner);
155155
}
156156

157-
async sshExec(
158-
command: string,
159-
parameters: string[],
160-
options: (SSHExecOptions & { stream?: "stdout" | "stderr" | undefined }) | undefined
161-
) {
157+
async sshExecCommand(command: string, options: SSHExecOptions | undefined) {
162158
if (!this.config.ssh) return;
163159
const ssh = new NodeSSH();
164160
try {
@@ -168,7 +164,7 @@ export default class GameServer {
168164
port: this.config.ssh.port,
169165
privateKeyPath: sshConfig.keyPath,
170166
});
171-
return await connection.exec(command, parameters, options);
167+
return await connection.execCommand(command, options);
172168
} catch (err) {
173169
console.error(err);
174170
}

app/services/webapp/api/gamemode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default async (webApp: WebApp): Promise<void> => {
3030
}
3131
let output = "";
3232

33-
await server.sshExec("gserv", ["update_repos", "rehash"], {
33+
await server.sshExecCommand("gserv update_repos rehash", {
3434
stream: "stderr",
3535
onStdout: buff => (output += buff),
3636
onStderr: buff => (output += buff),

0 commit comments

Comments
 (0)