MehulKhanna / PokeGrinder

An Auto-Grinding Bot for PokéMeow with Slash Commands! With a free Captcha Solver!
MIT License
12 stars 7 forks source link

Fishing issue #49

Closed Charlie1093 closed 5 months ago

Charlie1093 commented 5 months ago

Describe the bug If i use good rod the bot dosent pull the pokemons out at all, not even once

To Reproduce Steps to reproduce the behavior:

  1. Get 1000 fishing tokens in pokemeow
  2. Buy good rod in pokemeow
  3. Use it
  4. The bot wont pull out any fish

Expected behavior Expected it to pull it out and catch it (i tried mannually pulling it out and it caught the pokemon for me by itself) but wont pull the pokemon out

Screenshots 306108547-4b3e0ad6-e77d-4fa6-9b41-568fc163bf37

Desktop (please complete the following information):

Additional context I tried it 3 times but gave me the same results everytime

lufy20106 commented 5 months ago

i think it cant detect button using good rod

Charlie1093 commented 5 months ago

Oh, I actually had a similar thought, even though I don't know much about coding. In Pokemeow, the superior rod is automatically used, so I can't switch back to the old rod either. 😭 Anyways, thanks for letting me know.

I'm not sure if there's a similar issue with the super rod and the gold rod, but there's a good chance there might be, right? Just a little thought from this little brain haha.

MehulKhanna commented 5 months ago

Oh, I actually had a similar thought, even though I don't know much about coding. In Pokemeow, the superior rod is automatically used, so I can't switch back to the old rod either. 😭 Anyways, thanks for letting me know.

I'm not sure if there's a similar issue with the super rod and the gold rod, but there's a good chance there might be, right? Just a little thought from this little brain haha.

Since I only have an old rod, can you help me debug this?

MehulKhanna commented 5 months ago

Oh, I actually had a similar thought, even though I don't know much about coding. In Pokemeow, the superior rod is automatically used, so I can't switch back to the old rod either. 😭 Anyways, thanks for letting me know.

I'm not sure if there's a similar issue with the super rod and the gold rod, but there's a good chance there might be, right? Just a little thought from this little brain haha.

There was a similar issue with super rods and I had fixed it. Are you using the latest fishing.py file?

Charlie1093 commented 5 months ago

Oh, I actually had a similar thought, even though I don't know much about coding. In Pokemeow, the superior rod is automatically used, so I can't switch back to the old rod either. 😭 Anyways, thanks for letting me know. I'm not sure if there's a similar issue with the super rod and the gold rod, but there's a good chance there might be, right? Just a little thought from this little brain haha.

There was a similar issue with super rods and I had fixed it. Are you using the latest fishing.py file?

I guess, i downloaded the latest release, i am not too sure though. Here is the file

import json
import asyncio
from time import time
from random import randint

from discord import Message, InvalidData
from discord.ext import commands

from cogs.hunting import auto_buy
from cogs.startup import Config

fishes = json.load(open("fishes.json"))

class Fishing(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
        self.config: Config = bot.config

    @commands.Cog.listener()
    async def on_message(self, message: Message) -> None:
        if not message.interaction:
            return

        if (
            message.interaction.name != "fish spawn"
            or message.interaction.user != self.bot.user
            or message.channel.id != self.config.fishing_channel_id
        ):
            return

        if "Please wait" not in message.content:
            return

        await asyncio.sleep(self.config.retry_cooldown)
        await asyncio.sleep(randint(0, self.config.suspicion_avoidance) / 1000)
        await self.bot.fishing_channel_commands["fish spawn"]()

    @commands.Cog.listener()
    async def on_message_edit(self, before: Message, after: Message) -> None:
        if not after.interaction or not after.embeds:
            return

        if (
            after.interaction.user != self.bot.user
            or after.interaction.name != "fish spawn"
            or after.channel.id != self.config.fishing_channel_id
        ):
            return

        if (
            "Not even a nibble" in after.embeds[0].description
            or "The Pokemon got away..." in after.embeds[0].description
        ):
            self.bot.last_fish = time()
            await asyncio.sleep(self.config.fishing_cooldown)
            await asyncio.sleep(randint(0, self.config.suspicion_avoidance) / 1000)
            await self.bot.fishing_channel_commands["fish spawn"]()
            return

        elif (
            "cast out an" in after.embeds[0].description
            and "click the" in after.embeds[0].description
        ):
            self.bot.last_fish = time()

            try:
                await after.components[0].children[0].click()

            except InvalidData:
                pass

            return

        elif "fished out a wild" in after.embeds[0].description:
            self.bot.fish_encounters += 1

            if "shiny" in after.embeds[0].description.lower():
                ball = self.config.fish_balls["Shiny"]

            elif "golden" in after.embeds[0].description.lower():
                ball = self.config.fish_balls["Golden"]

            else:
                rarity = fishes[after.embeds[0].description.split("**")[3]]
                ball = self.config.fish_balls[rarity]

            balls = ["mb", "db", "prb", "ub", "gb", "pb"]
            balls = balls[balls.index(ball) :]

            buttons = [
                button
                for button in after.components[0].children
                for ball in balls
                if button.custom_id == ball + "_fish"
            ]

            if not buttons:
                return

            await asyncio.sleep(randint(0, self.config.suspicion_avoidance) / 1000)
            await buttons[-1].click()
            return

        elif "fished out a wild" in before.embeds[0].description:
            if "caught" in after.embeds[0].description:
                self.bot.fish_catches += 1

            tasks = []

            if "Your next Quest is now ready!" in before.content:
                tasks.append(asyncio.create_task(
                    self.bot.fishing_channel_commands["quest info"]()
                ))

            tasks.append(asyncio.create_task(
                auto_buy(self.bot, self.config, self.bot.fishing_channel_commands, after)
            ))

            await asyncio.sleep(self.config.fishing_cooldown)
            await asyncio.sleep(randint(0, self.config.suspicion_avoidance) / 1000)
            await self.bot.fishing_channel_commands["fish spawn"]()
            [await task for task in tasks]
            return
MehulKhanna commented 5 months ago

Oh, I actually had a similar thought, even though I don't know much about coding. In Pokemeow, the superior rod is automatically used, so I can't switch back to the old rod either. 😭 Anyways, thanks for letting me know. I'm not sure if there's a similar issue with the super rod and the gold rod, but there's a good chance there might be, right? Just a little thought from this little brain haha.

There was a similar issue with super rods and I had fixed it. Are you using the latest fishing.py file?

I guess, i downloaded the latest release, i am not too sure though. Here is the file

import json
import asyncio
from time import time
from random import randint

from discord import Message, InvalidData
from discord.ext import commands

from cogs.hunting import auto_buy
from cogs.startup import Config

fishes = json.load(open("fishes.json"))

class Fishing(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
        self.config: Config = bot.config

    @commands.Cog.listener()
    async def on_message(self, message: Message) -> None:
        if not message.interaction:
            return

        if (
            message.interaction.name != "fish spawn"
            or message.interaction.user != self.bot.user
            or message.channel.id != self.config.fishing_channel_id
        ):
            return

        if "Please wait" not in message.content:
            return

        await asyncio.sleep(self.config.retry_cooldown)
        await asyncio.sleep(randint(0, self.config.suspicion_avoidance) / 1000)
        await self.bot.fishing_channel_commands["fish spawn"]()

    @commands.Cog.listener()
    async def on_message_edit(self, before: Message, after: Message) -> None:
        if not after.interaction or not after.embeds:
            return

        if (
            after.interaction.user != self.bot.user
            or after.interaction.name != "fish spawn"
            or after.channel.id != self.config.fishing_channel_id
        ):
            return

        if (
            "Not even a nibble" in after.embeds[0].description
            or "The Pokemon got away..." in after.embeds[0].description
        ):
            self.bot.last_fish = time()
            await asyncio.sleep(self.config.fishing_cooldown)
            await asyncio.sleep(randint(0, self.config.suspicion_avoidance) / 1000)
            await self.bot.fishing_channel_commands["fish spawn"]()
            return

        elif (
            "cast out an" in after.embeds[0].description
            and "click the" in after.embeds[0].description
        ):
            self.bot.last_fish = time()

            try:
                await after.components[0].children[0].click()

            except InvalidData:
                pass

            return

        elif "fished out a wild" in after.embeds[0].description:
            self.bot.fish_encounters += 1

            if "shiny" in after.embeds[0].description.lower():
                ball = self.config.fish_balls["Shiny"]

            elif "golden" in after.embeds[0].description.lower():
                ball = self.config.fish_balls["Golden"]

            else:
                rarity = fishes[after.embeds[0].description.split("**")[3]]
                ball = self.config.fish_balls[rarity]

            balls = ["mb", "db", "prb", "ub", "gb", "pb"]
            balls = balls[balls.index(ball) :]

            buttons = [
                button
                for button in after.components[0].children
                for ball in balls
                if button.custom_id == ball + "_fish"
            ]

            if not buttons:
                return

            await asyncio.sleep(randint(0, self.config.suspicion_avoidance) / 1000)
            await buttons[-1].click()
            return

        elif "fished out a wild" in before.embeds[0].description:
            if "caught" in after.embeds[0].description:
                self.bot.fish_catches += 1

            tasks = []

            if "Your next Quest is now ready!" in before.content:
                tasks.append(asyncio.create_task(
                    self.bot.fishing_channel_commands["quest info"]()
                ))

            tasks.append(asyncio.create_task(
                auto_buy(self.bot, self.config, self.bot.fishing_channel_commands, after)
            ))

            await asyncio.sleep(self.config.fishing_cooldown)
            await asyncio.sleep(randint(0, self.config.suspicion_avoidance) / 1000)
            await self.bot.fishing_channel_commands["fish spawn"]()
            [await task for task in tasks]
            return

I had made a commit 2 days ago to the fishing.py. Please download it from the repository and not from the releases tab. It will fix your issue.

MehulKhanna commented 5 months ago

I have made some other changes to different files as well. So you might as well download the whole repository again.

Charlie1093 commented 5 months ago

Yes, i downloaded it from releases, redownloaded right now from repo and it works, thanks for the assistance khanna and lufy