コード例 #1
0
    async def work(self):
        """Send messages to add work to the configured person at a configured interval"""
        await self.client.wait_until_ready()

        # If disabled in configuration, don"t proceed
        if not self.config["enabled"] or not self.config["workfarming"]:
            return

        if self.client.shared["logging"]:
            utils.log("Sidneybot work farming enabled")

        while not self.client.is_closed():
            channel = self.client.get_channel(self.config["channel"])

            # Human typing delay
            delay = self.rand.randint(1, 3)

            # Farm work
            outbound = outbound_message.Outbound_Message("sid work", channel, delay)
            await outbound.send()

            if self.client.shared["logging"]:
                utils.log(f"Farmed Sidneybot work in {channel.id}")

            # Work farming delay
            delay = utils.get_delay(self.config["delay"], self.rand)

            # Delay the loop if configured
            await asyncio.sleep(utils.get_delay(self.config["delay"], self.rand))
コード例 #2
0
    async def rep(self):
        """Automate farming Tatsumaki rep with a configured recipient and interval"""

        if self.client.shared["logging"]:
            utils.log("Tatsumaki rep farming enabled")

        recipients = utils.list_generator(self.config["recipients"])
        channel = self.client.get_channel(self.config["channel"])

        while not self.client.is_closed():
            # Get a random recipient from one of the configured ones
            random_recipient = next(recipients)

            # Human typing delay
            delay = self.rand.randint(1, 3)

            # If configured, get the delay before deleting the message
            silent_delay = utils.get_delay(self.config["silent"], self.rand)

            # Give the recipient rep in the configured channel
            outbound = outbound_message.Outbound_Message(
                f"t!rep <@{random_recipient}>", channel, delay, silent_delay)
            await outbound.send()

            if self.client.shared["logging"]:
                utils.log(f"Gave tatsumaki rep to {random_recipient}")

            # Delay the loop if configured
            await asyncio.sleep(
                utils.get_delay(self.config["delay"], self.rand))
コード例 #3
0
    async def catch(self, channel, png):
        """Catch that pokeman and release it if it's garbage

        :param channel: Channel to catch the pokemon in
        :param png: Image to identify
        """
        # Create a perceptual difference hash of the image
        # A hash is just an identifier
        # Perceptual is how the image looks
        # Difference is a type of algorithm
        # Altogether: An identifier for how the image looks
        hash = str(imagehash.dhash(png))

        # Search through the list of hashes we already have for a match
        # The dictionary has keys of hashes and values of names
        # So we pass the hash and get the name of the Pokemon
        pokemon = self.hashes[hash]

        # Get the prefix for this channel
        prefixes = self.config["prefixes"]
        prefix = prefixes[channel.id]

        # Wait for any configured delays before catching the pokemon
        await asyncio.sleep(
            utils.get_delay(self.config["autocatchdelay"], self.rand))

        # Catch the pokemon
        await channel.send(f"{prefix}catch {pokemon}")

        # Next message should be a success message from Pokecord
        catch_or_fail = await self.client.wait_for("message",
                                                   check=self.pokecord_check)

        caught = self.check_catch(catch_or_fail)

        if not caught:
            if self.client.shared["logging"]:
                utils.log(f"Failed to catch {pokemon} in {channel.id}")

            return

        if self.client.shared["logging"]:
            utils.log(f"Caught {pokemon} in {channel.id}")

        # If configured, determine whether this pokeboi is worthy of keeping or not
        if self.config["autorelease"]:
            # Wait for a minute so that we don't get c**k blocked by pokecord cooldowns
            await asyncio.sleep(
                utils.get_delay(self.config["autocatchdelay"], self.rand))

            # Get info on the pokeboi we just caught
            await channel.send(f"{prefix}info latest")

            # Process the pokecord reply
            if await self.release(prefix):
                if self.client.shared["logging"]:
                    utils.log(f"Released {pokemon} in {channel.id}")
コード例 #4
0
ファイル: sushii.py プロジェクト: jan2705/DAB
    async def fishy(self):
        """Send messages to add fishies to the configured person at a configured interval"""

        if self.client.shared["logging"]:
            utils.log("Sushii fishy farming enabled")

        recipients = utils.list_generator(self.config["fishyrecipients"])
        channel = self.client.get_channel(self.config["channel"])

        while not self.client.is_closed():
            # Get a random recipient from one of the configured ones
            random_recipient = next(recipients)

            # Human typing delay
            delay = self.rand.randint(1, 3)

            # Give the random recipient fishies
            outbound = outbound_message.Outbound_Message(
                f"-fishy <@{random_recipient}>", channel, delay)
            await outbound.send()

            if self.client.shared["logging"]:
                utils.log(f"Gave sushii fishies to {random_recipient}")

            # Delay the loop if configured
            await asyncio.sleep(
                utils.get_delay(self.config["fishydelay"], self.rand))
コード例 #5
0
ファイル: sushii.py プロジェクト: ashishlodhi1234/DAB
    async def rep(self):
        """Send messages to add rep to the configured person at a configured interval"""
        await self.client.wait_until_ready()

        # If disabled in configuration, don"t proceed
        if not self.config["repfarming"]:
            return

        if self.client.shared["logging"]:
            utils.log("Sushii rep farming enabled")

        recipients = utils.list_generator(self.config["reprecipients"])

        while not self.client.is_closed():
            channel = self.client.get_channel(self.config["channel"])

            # Get a random recipient from one of the configured ones
            random_recipient = next(recipients)

            # Human typing delay
            delay = self.rand.randint(1, 3)

            # Give the random recipient rep
            outbound = outbound_message.Outbound_Message(
                f"-rep <@{random_recipient}>", channel, delay)
            await outbound.send()

            if self.client.shared["logging"]:
                utils.log(f"Gave sushii rep to {random_recipient}")

            # Delay the loop if configured
            await asyncio.sleep(
                utils.get_delay(self.config["repdelay"], self.rand))
コード例 #6
0
ファイル: pokecord.py プロジェクト: ashishlodhi1234/DAB
    async def release(self, prefix):
        """Release that garbage pokeman

        :param prefix: Prefix for the channel you caught that pokeman in
        """
        # Get the pokecord reply with our pokeboi info
        reply = await self.client.wait_for("message",
                                           check=self.pokecord_check)

        # If the message doesn't have an embed, ignore
        if len(reply.embeds) != 1:
            if self.client.shared["logging"]:
                utils.log("Failed to autorelease (no embeds)")

            return False

        # Get the embed where all the info is
        embed = reply.embeds[0]

        # Get the Total IV of the new pokeboi
        IV = utils.get_IV(embed)

        if float(IV) > self.config["minimumiv"]:
            return False

        pokeman_number = utils.get_pokeman_number(embed)

        # Wait for a minute so that we don't get c**k blocked by pokecord cooldowns
        delay = utils.get_delay(self.config["autocatchdelay"], self.rand)

        # Release that garbage pokeman
        outbound = outbound_message.Outbound_Message(
            f"{prefix}release {pokeman_number}", reply.channel, delay)
        await outbound.send()

        # More cooldowns
        delay = utils.get_delay(self.config["autocatchdelay"], self.rand)

        # Confirm you have standards
        outbound = outbound_message.Outbound_Message(f"{prefix}confirm",
                                                     reply.channel, delay)
        await outbound.send()

        return True
コード例 #7
0
ファイル: messages.py プロジェクト: jhxrvey9/DAB
    async def farm(self):
        """Send messages according to yaml config specifying frequency, channel, etc"""
        await self.client.wait_until_ready()

        # Don"t proceed if no channels are configured or configured to
        if not self.config["enabled"] or len(self.config["channels"]) == 0:
            return

        if self.client.shared["logging"]:
            utils.log("Message farming enabled")

            messages = utils.list_generator(self.config["messages"])

        while not self.client.is_closed():
            channels = self.config["channels"]
            # If configured, shuffle the channels to randomize the order we farm them
            if self.config["randomchannels"]:
                self.rand.shuffle(channels)

            for schannel in channels:
                # Create a channel object of the configured channel id
                channel = self.client.get_channel(schannel)

                # Get a random message from one of the configured ones
                random_message = next(messages)

                # If configured, get the delay before deleting the message
                if self.config["silent"]:
                    silent_delay = utils.get_delay(self.config["silent"],
                                                   self.rand)

                # Send a random message in the configured channel
                if self.config["silent"]:
                    await channel.send(random_message,
                                       delete_after=silent_delay)
                else:
                    await channel.send(random_message)

                if self.client.shared["logging"]:
                    utils.log(f"Sent \"{random_message}\" to {schannel}")

            # Delay the loop if configured
            await asyncio.sleep(
                utils.get_delay(self.config["delay"], self.rand))
コード例 #8
0
ファイル: messages.py プロジェクト: jan2705/DAB
    async def farm(self):
        """Automate sending messages with a configured frequency, channel, etc"""

        if self.client.shared["logging"]:
            utils.log("Message farming enabled")

        messages = utils.list_generator(self.config["messages"])
        channels = self.config["channels"]

        while not self.client.is_closed():
            # If configured, shuffle the channels to randomize the order we farm them
            if self.config["randomchannels"]:
                self.rand.shuffle(channels)

            for channel_id in channels:
                # Create a channel object of the configured channel id
                channel = self.client.get_channel(channel_id)

                # Get a random message from one of the configured ones
                random_message = next(messages)

                # Generate a human delay before sending the message
                delay = self.rand.randint(1, 3)

                # If configured, get the delay before deleting the message
                silent_delay = utils.get_delay(self.config["silent"],
                                               self.rand)

                # Send a random message in the configured channel
                outbound = outbound_message.Outbound_Message(
                    random_message, channel, delay, silent_delay)
                await outbound.send()

                if self.client.shared["logging"]:
                    utils.log(f"Sent \"{random_message}\" to {channel_id}")

            # Delay the loop if configured
            await asyncio.sleep(
                utils.get_delay(self.config["delay"], self.rand))
コード例 #9
0
    async def fishy(self):
        """Send messages to add fishies to the configured person at a configured interval"""
        await self.client.wait_until_ready()

        # If disabled in configuration, don"t proceed
        if not self.config["fishyfarming"]:
            return

        if self.client.shared["logging"]:
            utils.log("Sushii fishy farming enabled")

        recipients = utils.list_generator(self.config["fishyrecipients"])

        while not self.client.is_closed():
            channel = self.client.get_channel(self.config["channel"])

            # Get a random recipient from one of the configured ones
            random_recipient = next(recipients)

            # If configured, get the delay before deleting the message
            if self.config["silent"]:
                silent_delay = utils.get_delay(self.config["silent"],
                                               self.rand)

            # Send a random message in the configured channel
            if self.config["silent"]:
                await channel.send(f"-fishy <@{random_recipient}>",
                                   delete_after=silent_delay)
            else:
                await channel.send(f"-fishy <@{random_recipient}>")

            if self.client.shared["logging"]:
                utils.log(f"Gave sushii fishies to {random_recipient}")

            # Delay the loop if configured
            await asyncio.sleep(
                utils.get_delay(self.config["fishydelay"], self.rand))
コード例 #10
0
    async def bond(self):
        """Automate bonding with your Kohaipp pet with a configured channel"""

        if self.client.shared["logging"]:
            utils.log("Kohaiipp pet bonding enabled")

        channel = self.client.get_channel(self.config["bondchannel"])

        while not self.client.is_closed():
            # Human typing delay
            delay = self.rand.randint(1, 2)

            # Bond!
            outbound = outbound_message.Outbound_Message("pp!petb", channel, delay)
            await outbound.send()

            if self.client.shared["logging"]:
                utils.log(f"Kohaipp - Bonded in {channel.id}")

            # Delay the loop if configured
            await asyncio.sleep(utils.get_delay(self.config["bonddelay"], self.rand))
コード例 #11
0
    async def mine(self):
        """Automate mining for Kohaipp with a configured channel"""

        if self.client.shared["logging"]:
            utils.log("Kohaiipp mining enabled")

        channel = self.client.get_channel(self.config["minechannel"])

        while not self.client.is_closed():
            # Human typing delay
            delay = self.rand.randint(1, 2)

            # Mine!
            outbound = outbound_message.Outbound_Message("pp!m", channel, delay)
            await outbound.send()

            if self.client.shared["logging"]:
                utils.log(f"Kohaipp - Mined in {channel.id}")

            # Delay the loop if configured
            await asyncio.sleep(utils.get_delay(self.config["minedelay"], self.rand))
コード例 #12
0
    async def work(self):
        """Automate working for Sidneybot with a configured interval"""

        if self.client.shared["logging"]:
            utils.log("Sidneybot work farming enabled")

        channel = self.client.get_channel(self.config["channel"])

        while not self.client.is_closed():
            # Human typing delay
            typing_delay = self.rand.randint(1, 3)

            # Farm work
            outbound = outbound_message.Outbound_Message("sid work", channel, typing_delay)
            await outbound.send()

            if self.client.shared["logging"]:
                utils.log(f"Farmed Sidneybot work in {channel.id}")

            # Delay the loop if configured
            await asyncio.sleep(utils.get_delay(self.config["delay"], self.rand))
コード例 #13
0
ファイル: pokecord.py プロジェクト: ashishlodhi1234/DAB
    async def catch(self, channel, png):
        """Catch that pokeman and release it if it's garbage

        :param channel: Channel to catch the pokemon in
        :param png: Image to identify
        """
        # Create a perceptual difference hash of the image
        # A hash is just an identifier
        # Perceptual is how the image looks
        # Difference is a type of algorithm
        # Altogether: An identifier for how the image looks
        hash = str(imagehash.dhash(png, 16))

        # Search through the list of hashes we already have for a match
        # The dictionary has keys of hashes and values of names
        # So we pass the hash and get the name of the Pokemon
        pokemon = self.hashes[hash]

        # We use the uppercase verison of the pokemon a lot
        # So we will just create a variable for it here
        pupper = pokemon.upper()

        # Record latest pokemon that appeared in this channel
        self.pokebois[channel.id] = pupper

        # If whitelist is enabled, check if the pokemon we are trying to catch is whitelisted
        # If not, we're going to abort and not catch the pokemon
        if self.config["enablewhitelist"]:
            if pupper not in self.whitelist:
                if self.client.shared["logging"]:
                    utils.log(
                        f"{pokemon} ignored, not whitelisted. Channel: {channel.id}"
                    )

                return

        # If blacklist is enabled, check if the pokemon we are trying to catch is blacklisted
        # If it is, we're going to abort and not catch the pokemon
        if self.config["enableblacklist"]:
            if pupper in self.blacklist:
                if self.client.shared["logging"]:
                    utils.log(
                        f"{pokemon} ignored, blacklisted. Channel: {channel.id}"
                    )

                return

        # If configured, make pokemon name lowercase when we claim it
        # The idea is that it might look more human since we are presumably typing fast
        if self.config["lowercasepokemon"]:
            pokemon = pokemon.lower()

        # Get the prefix for this channel
        prefixes = self.config["prefixes"]
        prefix = prefixes[channel.id]

        async with channel.typing():
            # Wait for any configured delays before catching the pokemon
            await asyncio.sleep(
                utils.get_delay(self.config["autocatchdelay"], self.rand))

            # Check if the latest pokemon is still the one we are trying to catch
            # If not, this means someone has already caught it or a new one appeared
            # In which case we need to abort
            if self.pokebois[channel.id] != pupper:
                if self.client.shared["logging"]:
                    utils.log(f"{pokemon} was caught/replaced in {channel.id}")

                return

            await channel.send(f"{prefix}catch {pokemon}")

        # Next message should be a success message from Pokecord
        catch_or_fail = await self.client.wait_for("message",
                                                   check=self.pokecord_check)

        caught = self.check_catch(catch_or_fail)

        if not caught:
            if self.client.shared["logging"]:
                utils.log(f"Failed to catch {pokemon} in {channel.id}")

            return

        if self.client.shared["logging"]:
            utils.log(f"Caught {pokemon} in {channel.id}")

        # If configured, determine whether this pokeboi is worthy of keeping or not
        if self.config["autorelease"]:
            # Wait for a minute so that we don't get c**k blocked by pokecord cooldowns
            delay = utils.get_delay(self.config["autocatchdelay"], self.rand)

            # Get info on the pokeboi we just caught
            outbound = outbound_message.Outbound_Message(
                f"{prefix}info latest", channel, delay)
            await outbound.send()

            # Process the pokecord reply
            if await self.release(prefix):
                if self.client.shared["logging"]:
                    utils.log(f"Released {pokemon} in {channel.id}")