Fix this proj
This commit is contained in:
parent
562df25d0a
commit
c7c3c06170
9
index.ts
9
index.ts
|
@ -22,13 +22,13 @@ rcon.on("auth", () => {
|
|||
});
|
||||
|
||||
rcon.on("end", () => {
|
||||
console.log("RCON ended. Reconnecting in 1000ms.")
|
||||
console.log("RCON ended. Reconnecting in 2000ms.")
|
||||
if(rconReconnectTimeout) {
|
||||
clearTimeout(rconReconnectTimeout);
|
||||
}
|
||||
rconReconnectTimeout = setTimeout(() => {
|
||||
rcon.connect()
|
||||
}, 1000)
|
||||
}, 2000)
|
||||
})
|
||||
client.once(Events.ClientReady, async (readyClient) => {
|
||||
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
|
||||
|
@ -42,8 +42,11 @@ client.once(Events.ClientReady, async (readyClient) => {
|
|||
playerUsernames = playerUsernames.concat(f[1].content.split("\n"));
|
||||
if (!f[1].reactions.resolve("✅")) await f[1].react("✅");
|
||||
let member = f[1].member;
|
||||
|
||||
try {
|
||||
if (!member) member = await f[1].guild.members.fetch(f[1].author.id);
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (config.changeNicknames) {
|
||||
if (member.nickname !== f[1].content.split("\n")[0]) {
|
||||
try {
|
||||
|
|
18
rcon.ts
18
rcon.ts
|
@ -92,17 +92,17 @@ export class Rcon extends (EventEmitter as new () => TypedEmitter<Events>) {
|
|||
public connect = (): void => {
|
||||
if (this.tcp) {
|
||||
this._tcpSocket = net.createConnection(this.port, this.host);
|
||||
this._tcpSocket
|
||||
.on("data", (data) => {
|
||||
this._tcpSocket.on("data", (data) => {
|
||||
this._tcpSocketOnData(data);
|
||||
})
|
||||
.on("connect", () => {
|
||||
});
|
||||
this._tcpSocket.on("connect", () => {
|
||||
this.socketOnConnect();
|
||||
})
|
||||
.on("error", (err) => {
|
||||
this.emit("error", err);
|
||||
})
|
||||
.on("end", () => {
|
||||
});
|
||||
this._tcpSocket.on("error", (err) => {
|
||||
//this.emit("error", err);
|
||||
this.socketOnEnd()
|
||||
});
|
||||
this._tcpSocket.on("end", () => {
|
||||
this.socketOnEnd();
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue