Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Izocel committed May 13, 2024
2 parents ba38307 + 3a43fa2 commit c91b620
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"ollama",
"RCON",
"srcds"
]
],
"files.readonlyInclude": {
"{**/.c4z/.extsrcs/*.PROTSYM.cbl,**/.c4z/.extsrcs/*.PROTSYM.listing}": true
}
}
Binary file added assets/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/img/patriknorris.png
Binary file not shown.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"assets": "./assets",
"scripts": {
"uglify": "node ./gulp/main.js",
"watch": "npm run build && tsc -w",
"watch": "npm run clean && npm run build && tsc -w",
"clean": "rm -rf dist node_modules package-lock.json",
"build": "npm i && tsc && npm run copyExtraFiles",
"start": "npm run clean && npm run build && npm run nodeDist",
"nodeDist": "node ./dist/src/index.js",
"copyExtraFiles": "cp -rf ./api/certs -t ./dist/api && npm run sentry:ci",
"copyExtraFiles": "cp -rf ./api/certs -t ./dist/api && cp -rf ./assets -t ./dist",
"clear-branches": "git branch | xargs git branch -D",
"sentry:ci": "sentry-cli sourcemaps inject --org rvdprojects --project what-the-chuck ./dist && sentry-cli sourcemaps upload --org rvdprojects --project what-the-chuck ./dist"
},
Expand Down Expand Up @@ -55,4 +55,4 @@
"typescript": "^5.4.5",
"uglify-js": "^3.17.4"
}
}
}
36 changes: 12 additions & 24 deletions src/class/appClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ export class AppClient extends Client {
async start() {
await this.registerModules();
await this.registerBaseListener();

await this.login(process.env.botToken);
this.emit("warn", "\n\n|--------Bot is online!--------|\n\n");

await ytFetch.getVideos();
setInterval(async () => await ytFetch.getVideos(), 3600000);
Expand All @@ -73,7 +71,7 @@ export class AppClient extends Client {
const publics = [...coreCommands?.publics, ...pluginsCommands?.publics];
const privates = [...coreCommands?.privates, ...pluginsCommands?.privates];

this.on("ready", async () => {
this.on("shardReady", async () => {
try {
await this.registerCommands({ commands: publics });
const guildIds = process.env.guildIds.split(',');
Expand All @@ -85,8 +83,10 @@ export class AppClient extends Client {
});
}
} catch (error) {
console.error("On ready error:", error)
console.error("On Shard-Ready error:", error)
}

console.info("|--------Bot is online!--------|\n\n");
});
}

Expand All @@ -99,7 +99,7 @@ export class AppClient extends Client {
const pluginsDirectories = await getDirectories(pluginBasePath);

if (!pluginsDirectories?.length) {
console.warn("No plugins found:", pluginBasePath);
console.error("No plugins found:", pluginBasePath);
return { publics, privates };
}

Expand Down Expand Up @@ -149,33 +149,21 @@ export class AppClient extends Client {

if (guildId) {
try {
this.guilds.cache.get(guildId)?.commands.set(commands);
console.info(`\nRegistered ${commands.length} commands to ${guildId}`);
await this.application?.commands.set(commands, guildId);
console.info(`Registered ${commands.length} commands to ${guildId}`);
} catch { }

return;
}

this.application?.commands.set(commands);
console.info(`Registered ${commands.length} global commands\n`);
await this.application?.commands.set(commands);
console.info(`Registered ${commands.length} global commands`);
}

addClientLogger(id: string) {
if (!this.clientsLoggers?.has(id)) {
this.clientsLoggers.set(id, new AppLogger('client', id, 'info'));
this.emit('debug', `Your Client-logger: is online!`);
this.emit('warn', `Client-logger ${id}: is online!`);
}
else {
this.emit('warn', "Logger " + id + " already in the collection...");
this.emit('debug', "This logger already have a stream...");
}
}

logToClient(id: string, message: string) {
if (this.clientsLoggers?.has(id)) {
this.emit('debug', `Login to client ${id}: ` + message)
this.clientsLoggers.get(id).logger.info(message);
console.info(`Client-logger ${id}: is online!`);
}
}

Expand All @@ -189,7 +177,7 @@ export class AppClient extends Client {
commandFiles = await getFiles(dirPath);

if (!commandFiles?.length) {
console.warn("No commands found:", dirPath);
console.error("No commands found:", dirPath);
return { publics, privates };
}

Expand All @@ -208,7 +196,7 @@ export class AppClient extends Client {
const command: CommandType = await importFile(filePath);

if (!command?.name) {
console.error("Error a command import:");
console.error("Error at command import:", filePath);
console.error(command);
continue;
};
Expand Down
5 changes: 1 addition & 4 deletions src/commands/banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default new Command({
const type = args.getInteger("type", false) ? "goodbye" : "welcome";
const channel = args.getChannel('channel', false, [ChannelType.GuildText])
?? guild.systemChannel;

interaction?.channel?.sendTyping();
await sendBanner(member, type, channel);
interaction.reply({ content: "Done!", ephemeral: true });
Expand All @@ -52,8 +52,6 @@ export async function sendBanner(
interaction?: any) {

if (!member || member.user.bot) return;

debugger
const defConfigs = getGuildConfigsById("default");
const guildConfigs = getGuildConfigsById(member.guild.id) ?? defConfigs;

Expand All @@ -73,7 +71,6 @@ export async function sendBanner(
: member.guild.systemChannel;
channel = channelOverride ? channelOverride : channel;

debugger
const card = await newCard.render(member, cardData.getTitle(), cardData.getMsg({ member }));
return await DiscordManager.guildSend(channel, {
content: getContent({ member }),
Expand Down

0 comments on commit c91b620

Please sign in to comment.