Skip to content

Commit

Permalink
fix commands and captcha listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyou-Izumi committed Nov 7, 2023
1 parent aa285d2 commit 6d7eaab
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
22 changes: 12 additions & 10 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ process.on("SIGINT", async () => {
main()
}).on("messageCreate", async message => {
if(message.author.id != global.owoID) return;
if(
!message.content.includes(message.client.user?.username!) &&
!message.content.includes(message.client.user?.displayName!) &&
!message.content.includes(message.guild?.members.me?.displayName!) &&
!message.content.includes(message.client.user?.id!)
) return;
if(!(
message.channel.type == "DM" ||
message.content.includes(message.client.user?.id!) ||
message.content.includes(message.client.user?.username!) ||
message.content.includes(message.client.user?.displayName!) ||
message.content.includes(message.guild?.members.me?.displayName!)
)) return;
if(/are you a real human|(check|verify) that you are.{1,3}human!/img.test(message.content)) {
log(`Captcha Found in Channel: #${message.channel.type == "DM" ? message.channel.recipient.displayName : message.channel.name}`)
if(!global.config.autoResume && !global.config.captchaAPI) process.emit("SIGINT");
Expand Down Expand Up @@ -123,25 +124,26 @@ process.on("SIGINT", async () => {
}
}
}).on("messageCreate", async (message) => {
if(!global.captchaDetected) return;
if(!global.config.userNotify || message.author.id !== global.config.userNotify) return;
if(message.channel.type !== "DM" || message.channel.recipient.id !== global.config.userNotify || !global.captchaDetected) return;
if(/^[a-zA-Z]{3,6}$/.test(message.content)) {
let filter = (m:Message<boolean>) => m.author.id === global.owoID && m.channel.type == 'DM' && /(wrong verification code!)|(verified that you are.{1,3}human!)|(have been banned)/gim.test(m.content)
const msg = message
let filter = (m:Message<boolean>) => m.author.id === global.owoID && m.channel.type == 'DM' && /(wrong verification code!)|(verified that you are.{1,3}human!)|(have been banned)/gim.test(m.content)
try {
const owo = msg.client.users.cache.get(global.owoID)
if (!owo?.dmChannel) await owo?.createDM();
if(!owo || !owo.dmChannel) throw new Error("Could Not Reach OwO DM Channel");
await owo.send(msg.content)
const collector = owo.dmChannel.createMessageCollector({filter, max: 1, time: 15_000})
collector.once("collect", (m) => {msg.reply(m.content)})
collector.once("collect", (m) => {console.log(msg.content); msg.reply(m.content)})
} catch (error) {
log(`${error}`, "e")
msg.reply(`${error}`)
}
} else message.reply("Wrong syntax, this message will not be sent to OwO Bot!")
} else if(!(global.config.cmdPrefix && message.content.startsWith(global.config.cmdPrefix))) message.reply("Wrong syntax, this message will not be sent to OwO Bot!")
}).on("messageCreate", async (message) => {
if(!global.config.cmdPrefix) return;
if(!global.config.cmdPrefix || global.config.cmdPrefix.length === 0) return;
if(message.content.startsWith(global.config.cmdPrefix) && (message.author.id == global.config.userNotify || message.author.id == message.client.user?.id)) {
const args = message.content.slice(global.config.cmdPrefix.length).split(/ +/)
const commandName = args.shift()?.toLowerCase()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discord-owo-selfbot",
"version": "2.2.4",
"version": "2.2.5",
"description": "Ain't the best OwO Tool Farm, but worth a try (why not?)",
"type": "module",
"exports": "./dist/index.js",
Expand Down
3 changes: 1 addition & 2 deletions src/DataCollector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ const huntBot = (cache?:number) => {
type: "list",
message: "Select which huntbot trait to upgrade, empty to skip",
choices: [
{name: "Skip", value: NaN},
{name: "Efficiency", value: 1},
{name: "Duration", value: 2},
{name: "Cost", value: 3},
Expand Down Expand Up @@ -375,7 +374,7 @@ export const collectData = async (data:{[key:string]: Configuration}) => {
if(solveCaptcha != 0) autohunt = await getResult(trueFalse("Toggle Automatically send/receive AutoHunt/Huntbot", cache?.autoHunt))
if(autohunt) upgradetrait = await getResult(huntBot(cache?.upgradeTrait))
autogamble = await getResult(Gamble(cache?.autoGamble))
gamblingAmount = await getResult(gambleAmount(cache?.gamblingAmount))
if(autogamble.length > 0) gamblingAmount = await getResult(gambleAmount(cache?.gamblingAmount))
autoquote = await getResult(trueFalse("Toggle Automatically send owo/quotes to level up", cache?.autoQuote))
autoslash = await getResult(trueFalse("Toggle Automatically use slash commands", cache?.autoSlash))
autoother = await getResult(trueFalse("Toggle Automatically send Run/Pup/Piku commands", cache?.autoOther))
Expand Down
2 changes: 1 addition & 1 deletion src/Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const commandHandler = async () => {
}

const suffix = ".js"
const commandFiles = getFiles(path.join(process.cwd(), "/src/commands/"), suffix)
const commandFiles = getFiles(path.join(process.cwd(), "/dist/src/commands/"), suffix)

for(const command of commandFiles) {
let commandFile = await import(`file://${command}`)
Expand Down

0 comments on commit 6d7eaab

Please sign in to comment.