Fix this proj
This commit is contained in:
parent
562df25d0a
commit
c7c3c06170
11
index.ts
11
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;
|
||||
|
||||
if (!member) member = await f[1].guild.members.fetch(f[1].author.id);
|
||||
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 {
|
||||
|
|
26
rcon.ts
26
rcon.ts
|
@ -92,19 +92,19 @@ 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._tcpSocketOnData(data);
|
||||
})
|
||||
.on("connect", () => {
|
||||
this.socketOnConnect();
|
||||
})
|
||||
.on("error", (err) => {
|
||||
this.emit("error", err);
|
||||
})
|
||||
.on("end", () => {
|
||||
this.socketOnEnd();
|
||||
});
|
||||
this._tcpSocket.on("data", (data) => {
|
||||
this._tcpSocketOnData(data);
|
||||
});
|
||||
this._tcpSocket.on("connect", () => {
|
||||
this.socketOnConnect();
|
||||
});
|
||||
this._tcpSocket.on("error", (err) => {
|
||||
//this.emit("error", err);
|
||||
this.socketOnEnd()
|
||||
});
|
||||
this._tcpSocket.on("end", () => {
|
||||
this.socketOnEnd();
|
||||
});
|
||||
} else {
|
||||
this._udpSocket = dgram.createSocket("udp4");
|
||||
this._udpSocket
|
||||
|
|
Loading…
Reference in a new issue