Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Izocel committed Dec 9, 2024
2 parents cf56073 + a968705 commit 8335d8a
Show file tree
Hide file tree
Showing 17 changed files with 307 additions and 592 deletions.
9 changes: 8 additions & 1 deletion .envExample
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@ botToken=#######################################################
sentryDsn=#######################################################
OPENAI_API_KEY=###########################################
DB_CONN_STRING=##############
DB_NAME=############
DB_NAME=############

CS2_PORT_STILL_NO_CAKE=27015
CS2_TV_PORT_STILL_NO_CAKE=27016
CS2_RCON_PORT_STILL_NO_CAKE=27017
CS2_IP_STILL_NO_CAKE=##############
CS2_TV_PASS_STILL_NO_CAKE=##############
CS2_RCON_PASS_STILL_NO_CAKE=##############
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"fabricio",
"Innertube",
"ollama",
"RCON",
Expand Down
4 changes: 2 additions & 2 deletions api/Routers/cs2Router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const taskValidationRulesExample = [
Cs2Router.post('/logs', async (req: Request, res: Response) => {
const guild = await client.guilds.fetch("276931890735218689");
let channel = await guild?.channels.fetch("1185639534780764242") as TextBasedChannel;
const isText = channel?.isTextBased ?? false;
if (!isText) {

if (!channel?.isSendable()) {
return;
}

Expand Down
28 changes: 0 additions & 28 deletions devTools/AIModelsMerger.js

This file was deleted.

28 changes: 0 additions & 28 deletions devTools/aIModelsMerger.js

This file was deleted.

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;
RCON_PASS_192_168_1_128_27015:string;
RCON_PASS_192_168_1_128_27016:string;
DB_CONN_STRING:string,
DB_NAME:string,
}
Expand Down
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,40 @@
},
"dependencies": {
"@fabricio-191/valve-server-query": "^4.1.9",
"@sentry/cli": "^2.32.2",
"@sentry/node": "^8.19.0",
"@sentry/cli": "^2.36.2",
"@sentry/node": "^8.31.0",
"cors": "^2.8.5",
"discord-canvas": "^1.5.2",
"discord.js": "^14.15.3",
"discord.js": "^14.16.2",
"dotenv": "^16.4.5",
"express-session": "^1.18.0",
"express-validator": "^7.1.0",
"express-validator": "^7.2.0",
"fs": "^0.0.2",
"fs-extra": "^11.2.0",
"glob": "^10.4.5",
"helmet": "^7.1.0",
"https": "^1.0.0",
"mongodb": "^6.8.0",
"mongodb": "^6.9.0",
"node-fetch": "^2.7.0",
"openai": "^4.52.7",
"pino": "^9.3.1",
"openai": "^4.63.0",
"pino": "^9.4.0",
"WhatTheChuckBot": "file:",
"youtubei.js": "^9.4.0"
},
"devDependencies": {
"@babel/core": "^7.24.9",
"@babel/core": "^7.25.2",
"@types/express": "^4.17.21",
"@types/glob": "^8.1.0",
"@types/jquery": "^3.5.30",
"@types/node": "^20.14.11",
"express": "^4.19.2",
"@types/node": "^20.16.7",
"express": "^4.21.0",
"gulp": "^5.0.0",
"gulp-babel": "^8.0.0",
"gulp-concat": "^2.6.1",
"gulp-uglify": "^3.0.2",
"ts-node": "^10.9.2",
"ts-node-dev": "^2.0.0",
"typescript": "^5.5.3",
"uglify-js": "^3.19.0"
"typescript": "^5.6.2",
"uglify-js": "^3.19.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { hasCs2DockerAccess } from "../../../src/configs/guildsConfigs";
import { PATHS } from "../../../src";

export default new Command({
name: "cs-boot",
public: false,
name: "cs-docker",
public: true,
description: "Will do as you wish.",
options: [
{
name: "server", description: "(default) 0: cs2-WeConnected-ns1, 1: cs2-WeConnected-ns2",
name: "server", description: "(default) 0: CS2-SWT",
type: ApplicationCommandOptionType.Integer
},
{
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
6 changes: 3 additions & 3 deletions plugins/MemberUpdate/PremiumMemberListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export default class PremiumMemberListener {
}

// Else isNewBoost on extra-boost
console.warn("BOOSTER:", member.nickname);
console.warn("OLD BOOST VALUE:", oldMember.premiumSince);
console.warn("NEW BOOST VALUE:", member.premiumSince);
console.log("BOOSTER:", member.nickname);
console.log("OLD BOOST VALUE:", oldMember.premiumSince);
console.log("NEW BOOST VALUE:", member.premiumSince);
await sendBanner(member, "boost");
}

Expand Down
11 changes: 9 additions & 2 deletions plugins/Ollama/events/messageCreateOllama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ export default new Event("messageCreate", async (message: Message) => {
return;
}

await message.channel.sendTyping();
const typingInterval = setInterval(() => message.channel.sendTyping(), 5000);
const channel = message.channel;
if (!channel?.isSendable()) {
return;
}

await channel.sendTyping();
const typingInterval = setInterval(() => {
channel.sendTyping();
}, 5000);

!UsersState.get(author.id) && UsersState.set(author.id, { ...DefaultUserState });
let state = UsersState.get(author.id);
Expand Down
Loading

0 comments on commit 8335d8a

Please sign in to comment.