Skip to content

Commit

Permalink
Added sweeper (reduce memory), fixed time pause too long, added commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyou-Izumi committed Nov 25, 2024
1 parent 28dc70d commit a8c9c38
Show file tree
Hide file tree
Showing 32 changed files with 377 additions and 21 deletions.
17 changes: 17 additions & 0 deletions dest/src/commands/help.js
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
const helpCommand = {
name: "help",
description: "List of Tool Commands",
execute: (agent, message, ...args) => {
let document = "";
const listCommand = Object.keys(agent.commands);
for (const command of listCommand)
document += `**${command}:** ${agent.commands.get(command)?.description}\n`;
document += "Join Our Support Server For Help: https://discord.gg/Yr92g5Zx3e";
if (args[0])
message.reply(listCommand.includes(args[0])
? `**${args[0]}:** ${agent.commands.get(args[0])?.description}`
: "Command Not Found!");
else
message.reply(document);
}
};
export {};
10 changes: 10 additions & 0 deletions dest/src/commands/info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { timeHandler } from "../utils/utils.js";
const infoCommand = {
name: "info",
description: "Tool Information",
execute: (agent, message, ...args) => {
const status = agent.captchaDetected ? agent.paused ? "**PAUSED**" : "**PENDING CAPTCHA**" : "HUNTING";
message.reply(`__Uptime:__ **${timeHandler(agent.readyTimestamp ?? 0, Date.now())}**\n__Status:__ ${status}`);
}
};
export default infoCommand;
17 changes: 17 additions & 0 deletions dest/src/commands/pause.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const pauseCommand = {
name: "pause",
description: "Pause the Tool",
execute: (agent, message, ...args) => {
if (agent.captchaDetected) {
message.reply(agent.paused
? "Tool is already paused!"
: "**ACTION REQUIRED!** You must solve the captcha before pausing the tool");
}
else {
agent.captchaDetected = true;
agent.paused = true;
message.reply("Tool is paused!");
}
}
};
export default pauseCommand;
8 changes: 8 additions & 0 deletions dest/src/commands/ping.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const pingCommand = {
name: "ping",
description: "Tool Website Service Ping",
execute: (agent, message, args) => {
message.reply(`Pong! ${message.client.ws.ping}ms~`);
}
};
export default pingCommand;
12 changes: 12 additions & 0 deletions dest/src/commands/reload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const reloadCommand = {
name: "reload",
description: "Reload The Configuration",
execute: async (agent, message, ...args) => {
const attempt = await agent.aReload(true);
if (attempt)
message.reply("The configuration has been refreshed successfully");
else
message.reply("Failed to refresh the configuration");
}
};
export default reloadCommand;
17 changes: 17 additions & 0 deletions dest/src/commands/resume.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const resumeCommand = {
name: "resume",
description: "Resume the Tool",
execute: (agent, message, ...args) => {
if (agent.paused) {
agent.paused = false;
agent.captchaDetected = false;
message.reply("Tool is resume!");
agent.main();
}
else
message.reply(agent.captchaDetected
? "**ACTION REQUIRED!** You must solve the captcha before resuming the tool"
: "Tool is not paused!");
}
};
export default resumeCommand;
8 changes: 8 additions & 0 deletions dest/src/commands/say.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const sayCommand = {
name: "say",
description: "Make the Tool Perform command/say something",
execute: (agent, message, ...args) => {
message.channel.send(args.join(" "));
}
};
export default sayCommand;
30 changes: 30 additions & 0 deletions dest/src/commands/send.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const sendCommand = {
name: "send",
description: "Send cash to someone",
execute: (agent, message, ...args) => {
try {
if (message.channel.type == "DM" || message.channel.type == "GROUP_DM")
return message.reply("You must send this command in a server");
if (!args || args.length < 2)
return message.reply("You must mention someone and amount of cowoncy");
const target = message.mentions.members?.first();
const owo = message.guild?.members.cache.get(agent.owoID);
if (!target)
return message.reply("You must mention an user to send cowoncy");
if (!owo)
return message.reply("OwO bot not found!");
if (!args[1]?.match(/^[0-9]+$/))
return message.reply("You must include an amount of cowoncy to send");
message.channel.send(`owo send <@!${target.id}> ${args[1]}`);
message.channel.createMessageCollector({
filter: (msg) => msg.author.id == agent.owoID && msg.embeds.length > 0 && msg.embeds[0].author?.name.includes(msg.guild?.members.me?.displayName) && msg.embeds[0].author?.name.includes(target.displayName) && msg.components.length > 0,
max: 1, time: 10_000
}).once("collect", async (m) => { await m.clickButton({ X: 0, Y: 0 }); });
}
catch (error) {
message.reply("Failed to Perform command");
console.error(error);
}
}
};
export default sendCommand;
18 changes: 18 additions & 0 deletions dest/src/commands/solve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import decryptCaptcha from "../security/decrypt.js";
const solveCommand = {
name: "solve",
description: "Retry solving HCaptcha",
execute: async (agent, message, ...args) => {
if (!agent.captchaDetected)
return message.reply("No captcha detected");
try {
await decryptCaptcha(message, agent.config);
message.reply("✅ Captcha solved!");
}
catch (error) {
console.error(error);
message.reply("❌ Attempt to solve captcha failed.");
}
}
};
export default solveCommand;
13 changes: 13 additions & 0 deletions dest/src/commands/stop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { consoleNotify } from "../feats/notify.js";
import { logger } from "../utils/logger.js";
const stopCommand = {
name: "stop",
description: "Stop the Tool from Running",
execute: (agent, message, ...args) => {
message.reply("Shutting down...");
logger.info("User executed STOP command, shutting down...");
consoleNotify(agent.totalCommands, agent.totalTexts, agent.readyTimestamp ?? 0);
process.emit("SIGINT");
}
};
export default stopCommand;
Binary file modified dest/src/feats/Kyou.b2ki
Binary file not shown.
2 changes: 1 addition & 1 deletion dest/src/feats/presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const loadPresence = async (client) => {
const rpc = new RichPresence(client)
.setApplicationId("367827983903490050")
.setType("PLAYING")
.setName("Mirai")
.setName("Mirai Kuriyama")
.setDetails("The day the emperor returns!")
.setStartTimestamp(client.readyTimestamp ?? Date.now())
.setAssetsLargeImage(externalLinks[0].external_asset_path)
Expand Down
12 changes: 12 additions & 0 deletions dest/src/feats/sweeper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const loadSweeper = async (agent) => {
return agent.options.sweepers = {
messages: {
interval: 3_600,
lifetime: 1_800,
},
users: {
interval: 3_600,
filter: () => user => [...agent.RETAINED_USERS_IDS, user.client.user?.id].includes(user.id),
}
};
};
2 changes: 1 addition & 1 deletion dest/src/handler/commandHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const commandHandler = async (agent) => {
if (!command)
return;
try {
command.execute(message, args);
command.execute(agent, message, ...args);
}
catch (error) {
logger.error("Error executing command: " + command);
Expand Down
Loading

0 comments on commit a8c9c38

Please sign in to comment.