Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Izocel committed Oct 27, 2024
1 parent 0bc4f1b commit 37341c8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 0 additions & 2 deletions environments.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ declare global {
botToken: string;
guildIds: string;
inviteUrl: string;
CS2_RCON_PASS_192_168_1_128_27015:string;
CS2_RCON_PASS_192_168_1_128_27016:string;
DB_CONN_STRING:string,
DB_NAME:string,
}
Expand Down
9 changes: 6 additions & 3 deletions plugins/CS2/events/messageCreateCs2Chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default new Event("messageCreate", async (message) => {

try {
const configs = getGuildConfigsById(message.guildId)?.cs2?.chatChannels;
if (!configs?.length || !configs[message.channelId]) {
if (!(message.channelId in configs)) {
return;
}

Expand All @@ -26,12 +26,15 @@ export default new Event("messageCreate", async (message) => {

const connectionsParams = {
ip: serverConf.ip,
port: serverConf.port,
port: parseInt(serverConf.port),
timeout: 30000,
password: null
password: null,
debug: false
};

connectionsParams.port = parseInt(serverConf.rconPort);
connectionsParams.password = serverConf.password;

const rcon = await RCON(connectionsParams);
await rcon.exec(`say [${message.author.displayName}]: "${prompt.toString()}";`);
rcon.destroy();
Expand Down
8 changes: 5 additions & 3 deletions plugins/CS2/events/messageCreateCs2RCON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default new Event("messageCreate", async (message) => {

try {
const configs = getGuildConfigsById(message.guildId)?.cs2?.rconChannels;
if (!configs?.length || !configs[message.channelId]) {
if (!(message.channelId in configs)) {
return;
}

Expand All @@ -27,9 +27,10 @@ export default new Event("messageCreate", async (message) => {

const connectionsParams = {
ip: serverConf.ip,
port: serverConf.port,
port: parseInt(serverConf.port),
timeout: 30000,
password: null
password: null,
debug: false
};

let server = null;
Expand Down Expand Up @@ -58,6 +59,7 @@ export default new Event("messageCreate", async (message) => {
break;

default:
connectionsParams.port = parseInt(serverConf.rconPort);
connectionsParams.password = serverConf.password;
const rcon = await RCON(connectionsParams);
consoleOut = await rcon.exec(prompt);
Expand Down
12 changes: 8 additions & 4 deletions src/configs/guildsConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ export const guildsConfigs = [
"1300142162817581116": {
region: "US_EAST",
ip: env["CS2_IP_SWT"],
port: env["CS2_RCON_PORT_SWT"],
port: env["CS2_PORT_SWT"],
rconPort: env["CS2_RCON_PORT_SWT"],
password: env["CS2_RCON_PASS_SWT"],
},
},
chatChannels: {
"1300142238109794365": {
region: "US_EAST",
ip: env["CS2_IP_SWT"],
port: env["CS2_RCON_PORT_SWT"],
port: env["CS2_PORT_SWT"],
rconPort: env["CS2_RCON_PORT_SWT"],
password: env["CS2_RCON_PASS_SWT"],
}
},
Expand All @@ -90,15 +92,17 @@ export const guildsConfigs = [
"1300153496548544562": {
region: "US_EAST",
ip: env["CS2_IP_SWT"],
port: env["CS2_RCON_PORT_SWT"],
port: env["CS2_PORT_SWT"],
rconPort: env["CS2_RCON_PORT_SWT"],
password: env["CS2_RCON_PASS_SWT"],
},
},
chatChannels: {
"1300153496548544563": {
region: "US_EAST",
ip: env["CS2_IP_SWT"],
port: env["CS2_RCON_PORT_SWT"],
port: env["CS2_PORT_SWT"],
rconPort: env["CS2_RCON_PORT_SWT"],
password: env["CS2_RCON_PASS_SWT"],
}
},
Expand Down

0 comments on commit 37341c8

Please sign in to comment.