Example #1
0
 async def _chaff(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Activates Chaff Launcher.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Chaff Launcher::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 90:
         embed.description = TextChecker.replace_emotes(
             ":rp_utility1: Chaff launched successfully.\n"
             ":rp_utility1: Hostile Sensors are unable to track for 20 Seconds.\n"
             ":rp_utility1: Minor Heat Surge Detected.\n"
             "Allow **30 seconds** for utility to cool for optimal performance.", self.bot)
         embed.colour = discord.Colour.green()
     else:
         embed.description = TextChecker.replace_emotes(
             ":rp_utility0: Module Malfunction Detected.\n"
             ":rp_utility0: Chaff failed to launch.\n"
             ":rp_utility1: Minor Heat Surge Detected.\n"
             "Allow **30 seconds** for utility to cool before triggering.", self.bot)
         embed.colour = discord.Colour.red()
     await channel.send('', embed=embed)
Example #2
0
 async def _scb(self, ctx, who=None, channel: discord.TextChannel = None):
     """
      Activates Shield Cell Bank.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Shield Cell Bank::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 60:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Personal Shield Devices are recharged to full capacity.\n"
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Thermal Weaponry are recharged to full capacity.\n"
             ":rp_utility1: Massive Heat Surge Detected.\n"
             "Allow **5 minutes** for utility to cool for optimal performance.",
             self.bot)
         embed.colour = discord.Colour.green()
     elif chance > 90:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             ":rp_utility0: Module Malfunction Detected.\n"
             ":rp_utility0: Personal Shield Devices failed to recharge.\n"
             ":rp_utility0: Thermal Weaponry failed to recharge.\n"
             ":rp_utility1: Massive Heat Surge Detected.\n"
             ":rp_utility0: Meltdown Detected.\n"
             "Allow **5 minutes** for utility to cool before triggering.",
             self.bot)
         embed.colour = discord.Colour.red()
     else:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Personal Shield Devices are recharged to full capacity.\n"
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: hermal Weaponry are recharged to full capacity.\n"
             ":rp_utility1: Heat Surge Detected.\n"
             "Allow **60 seconds** for utility to cool for optimal performance.",
             self.bot)
         embed.colour = discord.Colour.orange()
     await channel.send('', embed=embed)
Example #3
0
 async def _ecu(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Activates Encryption Cracking Unit.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Encryption Cracking Unit::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 50:
         embed.description = TextChecker.replace_emotes(
             ":rp_utility1: Detected encrypted data deciphered.\n"
             ":rp_utility1: Any communications chatter intercepted.\n"
             ":rp_utility1: Hostile Viruses Purged.\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: All deciphered data stored on memory device.\n"
             ":rp_utility1: Heat Surge Detected.\n"
             "Allow **2 Minutes** for utility to cool for optimal performance.", self.bot)
         embed.colour = discord.Colour.green()
     elif chance > 80:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility0: Module Malfunction Detected\n"
             "Processing…\n"
             ":rp_utility0: The device has failed to respond.\n"
             "Processing…\n"
             ":rp_utility1: Massive Heat Surge Detected.\n"
             "Allow **2 Minutes** for utility to cool for optimal performance.",
             self.bot)
         embed.colour = discord.Colour.red()
     else:
         embed.description = TextChecker.replace_emotes(
             ":rp_utility1: Detected encrypted data deciphered.\n"
             "Processing…\n"
             ":rp_utility0: Failed to intercept communications chatter.\n"
             ":rp_utility1: Hostile Viruses Purged.\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: All deciphered data stored on memory device.\n"
             ":rp_utility1: Heat Surge Detected.\n"
             "Allow **2 Minutes** for utility to cool for optimal performance.", self.bot)
         embed.colour = discord.Colour.orange()
     await channel.send('', embed=embed)
Example #4
0
 async def _hsl(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Activates Heat Sink Launcher.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Heat Sink Launcher::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 90:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing...\n"
             ":rp_utility1: All Generated Heat successfully pulled from Utilities.\n"
             "Processing…\n"
             "Processing…\n"
             "Processing...\n"
             ":rp_utility1: All Generated Heat successfully pulled from Thermal Weaponry.\n"
             "Processing…\n"
             ":rp_utility1: Heat Sink spin cycle initiated, preparing to launch.\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Heat Sink launched successfully.",
             self.bot)
         embed.colour = discord.Colour.green()
     else:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing...\n"
             ":rp_utility1: All Generated Heat successfully pulled from Utilities.\n"
             "Processing…\n"
             "Processing…\n"
             "Processing...\n"
             ":rp_utility1: All Generated Heat successfully pulled from Thermal Weaponry.\n"
             "Processing…\n"
             ":rp_utility1: Heat Sink spin cycle initiated, preparing to launch.\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility0: Heat buildup exceeds Heat Sink capacity.  Preparing to Overcharge disk.\n"
             "WARNING: Keep clear of Heat Sink when launched;\n"
             ":rp_utility1: Overcharged Heat Sink launched, certain to explode on contact.\n"
             "Utility ready for use.", self.bot)
         embed.colour = discord.Colour.red()
     await channel.send('', embed=embed)
Example #5
0
 async def _kws(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Activates Kill Warrant Scanner.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Kill Warrant Scanner::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 90:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             "Processing...\n"
             ":rp_utility1: Identity Scan Completed.\n"
             ":rp_utility1: Information updated to any detected Visual Assistant Systems in the squad.\n"
             ":rp_utility1: Heat Surge Detected.\n"
             "Allow **30 seconds** for utility to cool for optimal performance.",
             self.bot)
         embed.colour = discord.Colour.green()
     else:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility0: Module Malfunction Detected.\n"
             ":rp_utility1: Identity Scan Failed.\n"
             ":rp_utility1: Heat Surge Detected.\n"
             "Allow **60 seconds** for utility to cool before triggering.",
             self.bot)
         embed.colour = discord.Colour.red()
     await channel.send('', embed=embed)
Example #6
0
 async def _egg(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Activates Electronic Ghost Generator.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Electronic Ghost Generator::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 90:
         embed.description = TextChecker.replace_emotes(
             ":rp_utility1: Frequencies generated successfully.\n"
             ":rp_utility1: Effective range is **100 Meters**.\n"
             ":rp_utility1: All individuals within 100 Meters are delirious and will experience hallucinations.\n"
             ":rp_utility1:  Massive Heat Surge Detected.\n"
             "Allow **2 Minutes** for utility to cool for optimal performance.\n"
             , self.bot)
         embed.colour = discord.Colour.green()
     else:
         embed.description = TextChecker.replace_emotes(
             ":rp_utility1: Frequencies generated successfully.\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility0: Module Malfunction Detected\n"
             "Processing…\n"
             ":rp_utility0: Effective range is **5 Meters**.\n"
             ":rp_utility1: " + (
                     who.nick or who.display_name) + " is delirious and will experience hallucinations.\n"
                                                     ":rp_utility1: Massive Heat Surge Detected.\n"
                                                     "Allow **2 Minutes** for utility to cool for optimal performance.\n",
             self.bot)
         embed.colour = discord.Colour.red()
     await channel.send('', embed=embed)
Example #7
0
    async def inventory_manipulation(self, ctx):
        db = await database.Database.get_connection(self.bot.loop)
        cooldown_check = "SELECT * FROM cheat_history WHERE user_id = $1 and code = $2 and use > $3"
        cooldown_data = (str(ctx.author.id), ctx.invoked_with,
                         ctx.message.created_at - timedelta(hours=23))
        async with db.transaction():
            async for (user_id, code,
                       last_use) in db.cursor(cooldown_check, *cooldown_data):
                cd_end = last_use + timedelta(hours=23)
                difference = cd_end - ctx.message.created_at
                if difference > timedelta(hours=12):
                    remaining = "almost a day"
                elif difference > timedelta(hours=6):
                    remaining = "less than 12 hours"
                elif difference > timedelta(hours=3):
                    remaining = "less than 6 hours"
                elif difference > timedelta(hours=1):
                    remaining = "less than 3 hours"
                else:
                    remaining = "less than 1 hour"
                to_delete = await ctx.send("You must wait for " + remaining +
                                           " to use this command again.")
                await asyncio.sleep(7)
                await to_delete.delete()
                return
        name, item, min_bound, max_bound, colour = self.cheats[
            ctx.invoked_with]
        text = TextChecker.replace_emotes(cheat_texts[name], self.bot)
        text = text.replace('[CMDR]', ctx.author.mention)
        amount = random.randint(min_bound, max_bound)

        embed = discord.Embed(description=text, colour=colour)
        embed.set_author(name=ctx.author.nick or ctx.author.display_name,
                         icon_url=ctx.author.avatar_url)

        await ctx.send(embed=embed)

        if item is not None:
            values = {
                'item': item,
                'quantity': amount,
                'hack': True,
                'discord_id': ctx.author.id,
                # 'discord_id': 294171600478142466,
                'key': config.TRANSACTION_KEY
            }
            response = await Web.get_response(iml, values)
        cheat_history_data = (str(ctx.author.id), ctx.invoked_with,
                              ctx.message.created_at)
        await db.execute("INSERT INTO cheat_history VALUES($1, $2, $3)",
                         *cheat_history_data)
Example #8
0
 async def _hdp(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Activates Holo-Me Decoy Projector.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Holo-Me Decoy Projector::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 90:
         embed.description = TextChecker.replace_emotes(
             ":rp_utility1: 28 Decoy Clones projected successfully.\n"
             ":rp_utility1: Audio Shimmering transmitted successfully.\n"
             ":rp_utility1: Immune to targeting for 10 Seconds.\n"
             ":rp_utility1: Massive Heat Surge Detected.\n"
             "Allow **2 Minutes** for utility to cool for optimal performance.", self.bot)
         embed.colour = discord.Colour.green()
     else:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             ":rp_utility0: Module Malfunction Detected.\n"
             ":rp_utility0: Decoy Clones failed to project.\n"
             ":rp_utility0: Audio Shimmering failed to transmit.\n"
             ":rp_utility1: Massive Heat Surge Detected.\n"
             "Allow **2 Minutes** for utility to cool before triggering.", self.bot)
         embed.colour = discord.Colour.red()
     await channel.send('', embed=embed)
Example #9
0
 async def _vdc(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Activates Virtual Distortion Cloak.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Virtual Distortion Cloak::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 90:
         embed.description = TextChecker.replace_emotes(
             ":rp_utility1: 60 Corrupted Holograms projected per minute.\n"
             ":rp_utility1: Generating disruptive audio successfully.\n"
             ":rp_utility1: Immune to recognition software for ten minutes.\n"
             ":rp_utility1: Massive Heat Surge Detected.\n"
             "Allow **2 Minutes** for utility to cool for optimal performance.", self.bot)
         embed.colour = discord.Colour.green()
     else:
         embed.description = TextChecker.replace_emotes(
             ":rp_utility0: Module Malfunction Detected.\n"
             ":rp_utility0: 400 Corrupted Holograms erratically projected before jamming projector orb.\n"
             ":rp_utility1: Disrupted audio hauntingly transmitted before overloading system memory.\n"
             ":rp_utility1: Failed to conceal identity, drawing attention.\n"
             ":rp_utility1: Massive Heat Surge Detected.\n"
             "Allow **2 Minutes** for utility to cool before triggering.", self.bot)
         embed.colour = discord.Colour.red()
     await channel.send('', embed=embed)
Example #10
0
 async def _els(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Activates Environmental Layout Scanner.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Environmental Layout Scanner::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 50:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Scan completed successfully.\n"
             "Processing…\n"
             ":rp_utility1: Landscape and structure layout updated.\n"
             "Processing…\n"
             ":rp_utility1: Data Package created, ready to download to a memory drive.\n"
             ":rp_utility1: Information updated to any detected Visual Assistant Systems in the squad.\n"
             ":rp_utility1: Heat Surge Detected.\n"
             "Allow **60 seconds** for utility to cool for optimal performance.",
             self.bot)
         embed.colour = discord.Colour.green()
     elif chance > 90:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             ":rp_utility0: Module Malfunction Detected.\n"
             ":rp_utility0: Scan failed.\n"
             ":rp_utility0: Landscape and structure layout failed to update.\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility0: Data Package failed, purging corrupted data.\n"
             ":rp_utility1: Heat Surge Detected.\n"
             "Allow **60 seconds** for utility to cool before triggering.",
             self.bot)
         embed.colour = discord.Colour.red()
     else:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Scan completed successfully.\n"
             "Processing…\n"
             ":rp_utility1: Landscape and structure layout updated.\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Valuable insight on environment detected.\n"
             "Processing…\n"
             ":rp_utility1: Data Package created, ready to download to a memory drive.\n"
             ":rp_utility1: Information updated to any detected Visual Assistant Systems in the squad.\n"
             ":rp_utility1: Heat Surge Detected.\n"
             "Allow **60 seconds** for utility to cool for optimal performance.",
             self.bot)
         embed.colour = discord.Colour.orange()
     await channel.send('', embed=embed)
Example #11
0
 async def _afmu(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Activates Auto Field Maintenance Unit.
     """
     if not await can_manage_bot(ctx):
         who = None
         channel = None
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     chance = random.randint(1, 100)
     embed = discord.Embed(title="**::Auto Field Maintenance Unit::**")
     
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         embed.set_author(name=who)
     
     if chance <= 50:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Armor Integrity restored to 100%.\n"
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Armor Modifier Integrity restored to 100%.\n"
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Malfunctioned Accessories restored to 100%.\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Malfunctioned Utilities restored to 100%.\n"
             ":rp_utility1: Large Heat Surge Detected.\n"
             ":rp_utility0: Meltdown Detected.\n"
             "Allow **10 minutes** for utility to cool for optimal performance.",
             self.bot)
         embed.colour = discord.Colour.green()
     elif chance > 75:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             "Processing…\n"
             ":rp_utility0: Module Malfunction Detected.\n"
             ":rp_utility0: Armor Integrity ignored by device.\n"
             ":rp_utility0: Armor Modifier Integrity ignored by device.\n"
             ":rp_utility0: Malfunctioned Accessories ignored by device.\n"
             ":rp_utility0: Malfunctioned Utilities ignored by device.\n"
             ":rp_utility1: Large Heat Surge Detected.\n"
             ":rp_utility0: Meltdown Detected.\n"
             "Allow **10 minutes** for utility to cool before triggering.",
             self.bot)
         embed.colour = discord.Colour.red()
     else:
         embed.description = TextChecker.replace_emotes(
             "Processing…\n"
             ":rp_utility0: Armor Integrity ignored by device.\n"
             "Processing…\n"
             ":rp_utility0: Armor Modifier Integrity ignored by device.\n"
             "Processing…\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Malfunctioned Accessories restored to 100%.\n"
             "Processing…\n"
             "Processing…\n"
             ":rp_utility1: Malfunctioned Utilities restored to 100%.\n"
             ":rp_utility1: Large Heat Surge Detected.\n"
             ":rp_utility0: Meltdown Detected.\n"
             "Allow **10 minutes** for utility to cool for optimal performance.",
             self.bot)
         embed.colour = discord.Colour.orange()
     await channel.send('', embed=embed)
Example #12
0
 async def _hack(self, ctx, who=None, channel: discord.TextChannel = None):
     """
     Initiates hack with specified difficulty.
     """
     prompt = await self.bot.get_channel(374691520055345162).send('{} is trying to hack something. Please select the level.'.format(ctx.author))
     await prompt.add_reaction('1\u20e3')
     await prompt.add_reaction('2\u20e3')
     await prompt.add_reaction('3\u20e3')
     await prompt.add_reaction('4\u20e3')
     await prompt.add_reaction('5\u20e3')
     await prompt.add_reaction('6\u20e3')
     
     self.prompt = prompt
     difficulty = 0
     try:
         reaction, user = await self.bot.wait_for('reaction_add', check=self.react_check, timeout=60.0)
         reaction = reaction.emoji
         if reaction == '1\u20e3':
             difficulty = 1
         elif reaction == '2\u20e3':
             difficulty = 2
         elif reaction == '3\u20e3':
             difficulty = 3
         elif reaction == '4\u20e3':
             difficulty = 4
         elif reaction == '5\u20e3':
             difficulty = 5
         elif reaction == '6\u20e3':
             difficulty = 6
     except asyncio.TimeoutError:
         await ctx.send('Admin is bussy. Please try to set the hack again later!')
         return
     
     if not await can_manage_bot(ctx):
         who = None
         channel = None
         difficulty = abs(difficulty)
     
     if difficulty > 0:
         limit = [
             10, 25, 40, 50, 70, 75,
         ]
     else:
         limit = [
             -1, -1, -1, -1, -1, -1,
         ]
     
     who = who or ctx.message.author
     channel = channel or ctx.channel
     
     embed = discord.Embed(title="**::Hacking sequence initiated for Security Level {}::**".format(abs(difficulty)),
                           description=TextChecker.replace_emotes(
                               ":rp_utility1: Encryption Cracking Unit paired with device.\n"
                               ":rp_utility1: Emulation Program Functional.\n"
                               ":rp_utility1: Data Package Compilation Program Functional.\n"
                               ":rp_utility1: Virus Defense Program Functional.", self.bot),
                           colour=discord.Colour.orange())
     if isinstance(who, discord.Member):
         embed.set_author(name=who.nick or who.display_name, icon_url=who.avatar_url)
     else:
         if who is not None:
             embed.set_author(name=who)
         else:
             embed.set_author(name='Unknown user')
     message = await channel.send('', embed=embed)
     await asyncio.sleep(self.delta)
     
     for i in range(abs(difficulty)):
         if i > 0:
             embed.remove_field(0)
             await asyncio.sleep(self.delta)
         
         prob = random.randint(0, 100)
         
         if prob > limit[i]:
             embed.add_field(name="**[Core Process {} of {}]**".format(i + 1, abs(difficulty)),
                             value=hacks_pass[i].format(embed.author.name), inline=False)
             await message.edit(embed=embed)
         else:
             embed.add_field(name="**[Core Process {} of {}]**".format(i + 1, abs(difficulty)),
                             value=hacks_fail[i].format(embed.author.name), inline=False)
             await message.edit(embed=embed)
             await asyncio.sleep(self.delta)
             embed.colour = discord.Colour.red()
             embed.add_field(name="**::Hacking sequence failed::**",
                             value=TextChecker.replace_emotes(
                                 ":rp_utility0: Encryption Cracking Unit disconnected from device.\n"
                                 ":rp_utility0: Emulation Program was locked out of the system.\n"
                                 ":rp_utility0: Data Package Failed, purging corrupted data.\n"
                                 ":rp_utility1: All hostile viruses quarantined and purged.\n"
                                 ":rp_utility1: Heat Surge Detected.\n"
                                 "Allow **30 seconds** for utility to cool for optimal performance.", self.bot))
             await message.edit(embed=embed)
             return 'hack'
     
     await asyncio.sleep(self.delta)
     embed.colour = discord.Colour.green()
     embed.add_field(name="**::Hacking sequence was completed successfully::**",
                     value=TextChecker.replace_emotes(
                         ":rp_utility1: Encryption Cracking Unit paired with device.\n"
                         ":rp_utility1: Emulation Program Operated Successfully.\n"
                         ":rp_utility1: Data Package Created, ready for download to memory drive.\n"
                         ":rp_utility1: All hostile viruses quarantined and purged.\n"
                         ":rp_utility1: Heat Surge Detected.\n"
                         "Allow **60 seconds** for utility to cool for optimal performance.", self.bot))
     await message.edit(embed=embed)
     return 'hack'
Example #13
0
    async def send_article(self, event_type, schedule=False):
        count_select = "SELECT min(used) as usage FROM messages WHERE message_type = $1"
        message_select = (
            "SELECT message_id, message_title, message_author, message_content, message_footer, message_color "
            "FROM messages WHERE message_type = $1 AND used = $2 ORDER BY "
            "floor(random()*(SELECT count(*) FROM messages WHERE used = $2)) LIMIT 1"
        )
        event_insert = "INSERT INTO schedule(event_time, event_type, event_special) VALUES ($1, 2, $2)"
        message_update = "UPDATE messages SET used = messages.used + 1 WHERE message_id = $1"
        today = datetime.utcnow()
        tomorrow = today + timedelta(days=1)
        in_a_week = today + timedelta(days=7)

        if event_type == 1:
            thumbnail = 'TheDailyChat.png'
            time = tomorrow.replace(hour=13, minute=0, second=0, microsecond=0)
        elif event_type == 2:
            thumbnail = 'GetTheTruth.png'
            time = tomorrow.replace(hour=18, minute=0, second=0, microsecond=0)
        elif event_type == 3:
            thumbnail = 'Forculus_Chronometry.png'
            time = in_a_week.replace(hour=10,
                                     minute=0,
                                     second=0,
                                     microsecond=0)
        elif event_type == 4:
            thumbnail = 'Vector.jpg'
            time = tomorrow.replace(hour=22, minute=0, second=0, microsecond=0)
        elif event_type == 5:
            thumbnail = 'PrismaticMediaNews.png'
            time = in_a_week.replace(hour=0, minute=0, second=0, microsecond=0)
        elif event_type == 6:
            thumbnail = 'GoodMorningCubeo.png'
            time = in_a_week.replace(hour=8, minute=0, second=0, microsecond=0)
        else:
            return
        event_values = [time, str(event_type)]

        db = await Database.get_connection(self.bot.loop)
        async with db.transaction():
            row = await db.fetchrow(count_select, event_type)
            values = [event_type, row['usage']]

            async for (message_id, message_title, message_author,
                       message_content, message_footer,
                       message_color) in db.cursor(message_select, *values):
                message_text = TextChecker.replace_emotes(
                    message_content, self.bot)
                channel = self.bot.get_channel(config.RP_CHANNEL)
                embed = discord.Embed(title=message_title,
                                      description=message_text,
                                      color=message_color)
                embed.set_author(name=message_author)
                embed.set_thumbnail(
                    url='http://nisanick.com/pictures/{}'.format(thumbnail))
                embed.set_footer(text=message_footer)
                await channel.send(embed=embed)
                await db.execute(message_update, message_id)

                if schedule:
                    await db.execute(event_insert, *event_values)
        await Database.close_connection(db)