Exemplo n.º 1
0
 async def set(self, ctx, set_type=None):
     if set_type.casefold() == "join":
         for channel in ctx.guild.channels:
             if channel.name == ctx.channel.name:
                 self.join = channel
                 embed = Embed(
                     title="Channel Set",
                     description=
                     "This channel will now be the welcomer channel for joining members.",
                     colour=Colour.green())
                 await ctx.send(embed=embed)
     elif set_type.casefold() == "leave":
         for channel in ctx.guild.channels:
             if channel.name == ctx.channel.name:
                 self.leave = channel
                 embed = Embed(
                     title="Channel Set",
                     description=
                     "This channel will now be the welcomer channel for leaving members.",
                     colour=Colour.green())
                 await ctx.send(embed=embed)
     else:
         embed = Embed(
             title="Usage:",
             description="`!set [join, leave]`\n**Example:** `!set join`",
             colour=Colour.red())
         await ctx.send(embed=embed)
Exemplo n.º 2
0
    async def ls(ctx: Context, limit: str = "5"):

        products = api.list_products(
            ProductQuery(taken=False, desc=True, limit=int(limit))
        )

        await ctx.message.delete()
        await ctx.channel.send(
            embed=embed(
                title="Detalhamento",
                description="Esses são os dados que tenho até o momento:",
                thumbnail=True,
                color=Colour.green(),
                fields=[
                    [
                        Field(key="Total", value=str(products.total.all)),
                        Field(
                            key="Disponíveis",
                            value=str(products.total.available),
                        ),
                        Field(
                            key="Resgatados", value=str(products.total.taken)
                        ),
                    ]
                ],
            )
        )

        for product in products.products:
            await ctx.channel.send(
                embed=embed(
                    title=product.code,
                    fields=[
                        [
                            Field(
                                key="UUID", value=product.uuid, inline=False
                            ),
                            Field(key="descrição", value=product.summary),
                            Field(
                                key="criado em",
                                value=product.created_at.strftime(
                                    env.datetime_formatter
                                ),
                                inline=False,
                            ),
                        ]
                    ],
                )
            )

        await ctx.channel.send(
            embed=embed(title="Final do Relatório.", color=Colour.green())
        )
Exemplo n.º 3
0
    async def withdrawal_notify(ctx, withdrawal_data: dict, fee):
        notify = Embed(
            title=":outbox_tray: Withdrawal Notification :outbox_tray:",
            description=f'Withdrawal Successfully processed',
            timestamp=datetime.utcnow(),
            colour=Colour.green())

        notify.add_field(name=":calendar: Time of withdrawal :calendar: ",
                         value=str(datetime.utcnow()),
                         inline=False)
        notify.add_field(name=':map: Destination :map: ',
                         value=f'```{withdrawal_data["destination"]}```',
                         inline=False)
        notify.add_field(name=CONST_HASH_STR,
                         value=f'`{withdrawal_data["hash"]}`',
                         inline=False)
        notify.add_field(
            name=':receipt: Withdrawal asset details :receipt: ',
            value=
            f'`{round(withdrawal_data["amount"] / 10000000, 7):.7f} {withdrawal_data["asset"]}`',
            inline=False)
        notify.add_field(name=':money_mouth: Crypto Link Fee :money_mouth: ',
                         value=f'`{fee}`',
                         inline=False)
        notify.add_field(
            name=':sunrise: Horizon Access Link :sunrise: ',
            value=f"[Complete Details]({withdrawal_data['explorer']})",
            inline=False)
        notify.set_thumbnail(url=ctx.message.author.avatar_url)

        try:
            await ctx.author.send(embed=notify)

        except errors.DiscordException:
            error_msg = Embed(
                title=f':warning: Withdrawal Notification :warning:',
                description=f'You have received this message because'
                f' withdrawal notification could not be'
                f' send to DM. Please allow bot to send'
                f' you messages',
                colour=Colour.green())
            error_msg.add_field(name=':compass: Explorer Link :compass:'******'explorer'])
            error_msg.set_footer(
                text='This message will self-destruct in 360 seconds')
            await ctx.channel.send(embed=error_msg,
                                   content=f'{ctx.message.author.mention}',
                                   delete_after=360)
Exemplo n.º 4
0
async def on_join_builder(member, message=None):
    """
    Returns a message to send to the member who joined the server

    member: discord.Member
        -> welcome_message: discord.Embed
    """

    welcome_message = Embed(title=f"Welcome to {member.guild.name}!")

    if not message:
        message = f"Welcome to {member.guild.name}! Please remember to be"\
                  " kind and courteous. If you would like to join in " \
                  "bot testing, please run '.bottester' to have the role "\
                  "assigned to you."
    else:
        footer = "Note: This message was not created by the bot author.\n" \
                 "If you find it offensive, contact the moderation team for "\
                 f"{member.guild.name}"
        welcome_message.set_footer(text=footer)

    welcome_message.colour = Colour.green()
    welcome_message.set_thumbnail(url=member.guild.icon_url)
    welcome_message.thumbnail.height = 128
    welcome_message.thumbnail.width = 128
    welcome_message.description = message

    return welcome_message
Exemplo n.º 5
0
 async def stats(self, ctx):
     if not registered(ctx.author.id):
         await send_notregistered_msg(ctx)
         return
     embed = Embed(title="User Stats",
                   description=f"**{ctx.author.name}'s Stats**",
                   colour=Colour.green())
     embed.set_thumbnail(url=ctx.author.avatar_url)
     embed.add_field(name="Balance",
                     value=f":moneybag: `{get_cash(ctx.author)}`",
                     inline=True)
     embed.add_field(name="Bank",
                     value=f":bank: `{get_bank(ctx.author)}`",
                     inline=True)
     embed.add_field(name="Exp",
                     value=f":military_medal: `{get_exp(ctx.author)}`",
                     inline=True)
     embed.add_field(name="Reputation",
                     value=f":rosette: `{get_reputation(ctx.author)}`",
                     inline=True)
     embed.add_field(name="Love",
                     value=f":heart: `{get_love(ctx.author)}`",
                     inline=True)
     embed.add_field(name="VIP Package",
                     value=f":crown: `{get_vip(ctx.author)}`",
                     inline=True)
     await ctx.channel.trigger_typing()
     await asyncio.sleep(2)
     time = datetime.datetime.now()
     embed.set_footer(text=time.strftime(f"As of %B %d, %Y | %I:%M %p"))
     await ctx.send(embed=embed)
Exemplo n.º 6
0
 async def on_guild_join(self, guild):
     tracker = await self.bot.fetch_channel(TRACKER)
     bots = sum(1 for m in guild.members if m.bot)
     members = len(guild.members)
     ratio = bots / members
     embed = discord.Embed(color=Colour.green())
     embed.title = f"Joined Server"
     embed.description = f"{guild}"
     embed.add_field(name="Members", value=f"{members - bots}")
     embed.add_field(name="Bots", value=f"{bots}")
     embed.add_field(name="** **", value="** **")
     embed.add_field(name="Owner", value=f"{guild.owner}")
     embed.add_field(name="Mention", value=f"{guild.owner.mention}")
     embed.add_field(name="Id", value=f"{guild.owner.id}")
     embed.set_footer(text=f"{guild.id}")
     await tracker.send(embed=embed)
     if ratio >= 0.6 and members >= 20:
         log.info("Detected bot collection server ({}), ratio {}. Leaving.".
                  format(guild.id, ratio))
         try:
             await guild.owner.send(
                 "Please do not add me to bot collection servers. "
                 "Your server was flagged for having over 60% bots. "
                 "If you believe this is an error, please PM the bot author."
             )
         except:
             pass
         await asyncio.sleep(members / 200)
         await guild.leave()
     else:
         await self.bot.change_presence(activity=discord.Game(
             f"with {len(self.bot.guilds)} servers | !help | v{self.bot.version}"
         ),
                                        afk=True)
Exemplo n.º 7
0
def create_survey(title, text, author, answers, max_answers, url, survey_id):
    answers_text = "\n".join([f'{e} - {answers[e]}' for e in answers])
    embed = Embed(title='Umfrage #' + str(survey_id) + ': ' + title, color=Colour.green(), url=url)
    embed.timestamp = datetime.datetime.utcnow()
    embed.add_field(name='Frage:', value=text, inline=False)
    embed.add_field(name='Antwortmöglichkeiten:', value=answers_text, inline=False)
    embed.add_field(name='Antwort:',
                    value=f'Beantworte diese Umfrage mit:\n'
                          f'{cfg.get("invoke_normal")}answer #{survey_id} 1-{len(answers)}\n'
                          f'Mehrfachantwort:\n'
                          f'{cfg.get("invoke_normal")}answer #{survey_id} 1 2\n'
                          f'Du kannst maximal {max_answers} Antworten angeben'
                    )
    embed.add_field(name='Ergebnisse:',
                    value=f'Ergebnisse erhälst du mit:\n{cfg.get("invoke_normal")}result #{survey_id}')
    embed.add_field(name='Keine weitere Umfrage:',
                    value=f'Wenn du keine weiteren Umfragen mehr erhalten willst, verwende: '
                          f'{cfg.get("invoke_normal")}sub False')
    embed.add_field(name='Information:',
                    value=f'Diskutiere über diese Umfrage in <#{cfg.get("channel_ids", dict()).get("main", 0)}>.\n'
                          'Du kannst deine Antwort nicht mehr ändern.\n'
                          'Diese Umfrage ist anonym.\n'
                          'Bei Fragen wende dich an die Developer.')
    embed.set_footer(text="Umfrage von " + author.name)
    return embed
Exemplo n.º 8
0
    async def eval(self):
        global bind_channel
        global paused
        global playlist

        if not player or player.is_done():
            raise CommandFailure("Not playing anything!")

        duration = str(datetime.timedelta(seconds=int(player.duration)))

        # Construct embed
        col = Colour.red() if paused else Colour.green()
        state = "Paused" if paused else "Playing"
        state = "Now " + state + ": [%s] %s" % (duration, player.title)

        ti = "Up Next:" if len(playlist) > 0 else ""
        embed = Embed(title=ti, colour=col)
        embed.set_author(name=state)
        embed.set_footer(text="!m play [link/search]")

        i = 0
        for song in playlist:
            i += 1

            duration = datetime.timedelta(seconds=int(song['duration']))
            title = "%d. [%s] %s" % (i, str(duration), song['title'])

            embed.add_field(name=title,
                            value="Added by: %s" % nick(song['author']),
                            inline=False)

        await self.client.send_message(bind_channel, embed=embed)
Exemplo n.º 9
0
 async def pizza(self, ctx):
     embed = Embed(type="rich", colour=Colour.green())
     embed.set_image(
         url=
         "https://cdn.discordapp.com/attachments/692486367422447649/693246228238172170/pizza.jpg"
     )
     await ctx.send(None, embed=embed)
Exemplo n.º 10
0
 async def _send_confirmation(ctx: Context, on_success: str) -> None:
     """Send an embed confirming the reminder change was made successfully."""
     embed = Embed()
     embed.colour = Colour.green()
     embed.title = random.choice(POSITIVE_REPLIES)
     embed.description = on_success
     await ctx.send(embed=embed)
Exemplo n.º 11
0
    async def _send_confirmation(ctx: Context, response: dict, on_success: str):
        """
        Send an embed confirming whether or not a change was made successfully.

        :return: A Boolean value indicating whether it failed (True) or passed (False)
        """

        embed = Embed()

        if not response.get("success"):
            embed.colour = Colour.red()
            embed.title = random.choice(NEGATIVE_REPLIES)
            embed.description = response.get("error_message", "An unexpected error occurred.")

            log.warn(f"Unable to create/edit/delete a reminder. Response: {response}")
            failed = True

        else:
            embed.colour = Colour.green()
            embed.title = random.choice(POSITIVE_REPLIES)
            embed.description = on_success

            failed = False

        await ctx.send(embed=embed)
        return failed
    async def send_ticket_message_author(self, ctx, time_of_request,
                                         department, ticket_id, support_msg,
                                         colour):
        try:
            user_msg = Embed(title='__Support ticket issued successfully__',
                             description='Automatic System Message',
                             timestamp=time_of_request,
                             colour=Colour.green())
            user_msg.set_thumbnail(url=self.bot.user.avatar_url)

            user_msg.add_field(
                name='Sys message',
                value=f'We would like to inform you that your support ticket'
                f' has been received successfully. One of the '
                f'support staff  will be in contact with you as soon as possible!',
                inline=False)
            user_msg.add_field(name='Community:',
                               value=f'{ctx.message.guild}',
                               inline=False)
            user_msg.add_field(name='Department:',
                               value=f'{department}',
                               inline=False)
            user_msg.add_field(name="Reference Support Ticker Number",
                               value=ticket_id,
                               inline=False)
            user_msg.add_field(name="Request message",
                               value=f'{support_msg}',
                               inline=False)
            user_msg.set_footer(
                text='Service provided by Launch Pad Investments')
            await ctx.author.send(embed=user_msg)
            return True
        except Exception:
            return False
Exemplo n.º 13
0
async def recipient_incoming_notification(recipient, sender, wallet_level, data: dict, response: dict):
    """
    Notification for recipient when payment has been sent by the recipient to the Level 1 and Level 2
    account.
    """
    recipient_notify = Embed(title=f"Incoming Funds",
                             description="You have received this notification because someone made transaction "
                                         "to your wallet ",
                             colour=Colour.green(), timestamp=datetime.utcnow())
    recipient_notify.add_field(name=f'Deposit Wallet Level',
                               value=f'{wallet_level}', )
    recipient_notify.add_field(name=f'Memo',
                               value=f'{response["memo"]}', )
    recipient_notify.add_field(name=f'Sender',
                               value=f'{sender} \n'
                                     f'({sender.id})')
    recipient_notify.add_field(name=f':hash: Transaction Hash :hash:',
                               value=f'```{response["hash"]}```',
                               inline=False)
    recipient_notify.add_field(name=f'Payment Value',
                               value=f'{data["netValue"]} {data["token"]}')
    recipient_notify.add_field(name=":mega: Note :mega:",
                               value=f'If wallet level 1 was used as destination, Crypto Link '
                                     f'will notify you once deposit has been successfully processed.'
                                     f' For level wallet 2 you can use commands dedicated to ***Horizon***'
                                     f' queries. Be sure to say __Thank You___ to sender.')
    recipient_notify.add_field(name=f':sunrise: Horizon Links :sunrise:',
                               value=f'[Transaction]({response["_links"]["self"]["href"]})\n'
                                     f'[Operations]({response["_links"]["operations"]["href"]})\n'
                                     f'[Effects]({response["_links"]["effects"]["href"]})')

    try:
        await recipient.send(embed=recipient_notify)
    except Exception:
        pass
Exemplo n.º 14
0
async def send_operation_details(destination, envelope: str, network_type):
    """
    Send information to sender on operations inside transaction
    """
    data = TransactionEnvelope.from_xdr(envelope, network_type)
    operations = data.transaction.operations

    count = 1
    for op in operations:
        op_info = Embed(title=f'Operation No.{count}',
                        colour=Colour.green())
        if isinstance(op, Payment):
            print("++++++++++++++++++++++")
            op_info.add_field(name=f'Payment To:',
                              value=f'```{op.destination}```',
                              inline=False)
            if isinstance(op.asset, Asset):
                op_info.add_field(name=f'Payment Value',
                                  value=f'`{op.amount} {op.asset.code}`')

        elif isinstance(op, CreateAccount):
            op_info.add_field(name=f'Create Account for',
                              value=f'{op.destination}')
            op_info.add_field(name=f'Starting Balance',
                              value=f'{op.starting_balance}')

        await destination.send(embed=op_info)
        count += 1
Exemplo n.º 15
0
    async def get_mythicplus_affix(self, ctx):
        """
        Get the Mythic+ affixes of this week.
        """
        guild_server = GuildServer.objects.filter(guild_id=ctx.guild.id, default=True).first()
        region = "us"
        if guild_server:
            region = guild_server.get_region_display()
        params = {
            "namespace": f"dynamic-{region}",
            "locale": "en-US"
        }
        r = battlenet_util.execute_battlenet_request(f"https://{region}.api.blizzard.com/data/wow/mythic-challenge-mode/", params=params)
        json_mythicplus = r.json()
        embed = Embed()
        embed.set_thumbnail(url="http://wow.zamimg.com/images/wow/icons/large/inv_relics_hourglass.jpg")
        current_difficulty = 0
        embed, current_difficulty = affixEmbed(embed, current_difficulty, json_mythicplus['current_keystone_affixes'][0])
        embed, current_difficulty = affixEmbed(embed, current_difficulty, json_mythicplus['current_keystone_affixes'][1])
        embed, current_difficulty = affixEmbed(embed, current_difficulty, json_mythicplus['current_keystone_affixes'][2])
        embed, current_difficulty = affixEmbed(embed, current_difficulty, json_mythicplus['current_keystone_affixes'][3])

        if current_difficulty <= 3:
            embed.colour = Colour.green()
        elif current_difficulty == 4:
            embed.colour = Colour.from_rgb(255, 255, 0)
        else:
            embed.colour = Colour.red()
        await ctx.send(embed=embed)
Exemplo n.º 16
0
    async def on_message(self, message):
        self.testServerModMail = self.get_channel(804202154784718848)

        if not message.author.bot:
            if isinstance(message.channel, DMChannel):
                if len(message.content) < 10:
                    await message.channel.send("Your message should be atleast 10 characters in length.")

                else:
                    embed = Embed(title=f'''{message.author.name}#{message.author.discriminator} slid into Chimkin's DMs''',
                                  colour=Colour.green(),
                                  timestamp=datetime.utcnow())

                    embed.set_thumbnail(url=message.author.avatar_url)

                    fields = [('Member', message.author.name, False),
                              ('Message', message.content, False)]

                    for name, value, inline in fields:
                        embed.add_field(name=name, value=value, inline=inline)

                    await self.testServerModMail.send(embed=embed)
                    await message.channel.send("Thanks for using Chimkin Modmail! The concerning parties will reply to your queries as soon as possible!")

                mod = self.get_cog('Mod')

            else:
                await self.process_commands(message)
 async def help(self, ctx):
     help_nfo = Embed(
         title=f'Welcome to virtual air marshall',
         description=
         'Welcome to help menu. All available command entry points are presented below',
         colour=Colour.green())
     help_nfo.add_field(
         name=f'Bot links',
         value=
         f'[Web Page](https://launch-pad-investments.github.io/virtual-air-marshal/)\n'
         f'[Github](https://github.com/launch-pad-investments/virtual-air-marshal)',
         inline=False)
     help_nfo.add_field(name=f'Administrative section',
                        value=f'```{self.command}admin```',
                        inline=False)
     help_nfo.add_field(name=f'Service registration area',
                        value=f'```{self.command}services```',
                        inline=False)
     help_nfo.add_field(name=f'Logger handler commands',
                        value=f'```{self.command}logger```',
                        inline=False)
     help_nfo.add_field(name=f'Spam protection handler commands',
                        value=f'```{self.command}spam```',
                        inline=False)
     await ctx.channel.send(embed=help_nfo)
Exemplo n.º 18
0
 async def help(self, ctx):
     title = ':sos: ___Available Command Categories__ :sos: '
     description = f"Available sub commands for `{self.command_string}help`"
     list_of_commands = [
         {
             "name": ":judge: Delegate on-demand",
             "value": f"```{self.command_string}delegate```\n"
             f"`Alias:d`"
         },
         {
             "name": ":ballot_box: Commands for voter",
             "value": f"```{self.command_string}voter```"
         },
         {
             "name": ":toolbox: Commands for server owner",
             "value": f"```{self.command_string}sys```"
         },
         {
             "name": ":toolbox: Commands to query DPOPS network",
             "value": f"```{self.command_string}dpops```"
         },
     ]
     await customMessages.embed_builder(ctx=ctx,
                                        c=Colour.green(),
                                        title=title,
                                        description=description,
                                        list_of_commands=list_of_commands)
Exemplo n.º 19
0
    async def show_numbers(self) -> None:
        lobby_count = len(self.players)
        if self.is_ready():
            title = "We got a game!"
        elif lobby_count >= 8:
            title = "I think we got numbers!"
        elif lobby_count == 0:
            title = "We absolutely do **not** have numbers."
        else:
            title = "These are some numbers for sure."

        voice_count = 0
        for channel in self.bot.get_all_channels():
            if isinstance(channel, VoiceChannel):
                voice_count += sum(not m.bot for m in channel.members)

        online_count = 0
        for guild_member in self.channel.guild.members:
            if not (guild_member.bot) and guild_member.status == Status.online:
                online_count += 1

        color = Colour.green() if self.is_ready() else Colour.orange()
        embed = Embed(colour=color)
        embed.title = title
        embed.add_field(name="Online", value=online_count, inline=False)
        embed.add_field(name="In Voice", value=voice_count, inline=False)
        embed.add_field(name="Joined", value=lobby_count, inline=False)
        embed.add_field(name="Ready", value=self.ready_count(), inline=False)
        await self.channel.send(embed=embed)
async def transaction_result(destination, result_data: dict):
    try:
        links = result_data["_links"]
        result_nfo = Embed(
            title=
            ':white_check_mark: Transaction Sent Successfully :white_check_mark: ',
            colour=Colour.green())
        result_nfo.add_field(name=':calendar: Created at :calendar: ',
                             value=f'{result_data["created_at"]}')
        result_nfo.add_field(
            name=':money_with_wings:  Fee Payed :money_with_wings:  ',
            value=f'`{int(result_data["fee_charged"]) / (10 ** 7):.7f} XLM`')
        result_nfo.add_field(name=':ledger:  Ledger :ledger:  ',
                             value=f'`{result_data["ledger"]}`')
        result_nfo.add_field(name=':pencil: Memo :pencil:   ',
                             value=f'`{result_data["memo"]}`')
        result_nfo.add_field(name=':tools: Operations Count :tools:    ',
                             value=f'`{result_data["operation_count"]}`')
        result_nfo.add_field(
            name=':white_circle: Paging Token :white_circle: ',
            value=f'`{result_data["paging_token"]}`')
        result_nfo.add_field(name=':map: Source Account :map: ',
                             value=f'```{result_data["source_account"]}```',
                             inline=False)
        result_nfo.add_field(
            name=f':sunrise: Horizon Link :sunrise: ',
            value=f'[Account]({links["account"]["href"]})  |  '
            f'[Operations]({links["operations"]["href"]})  |  '
            f'[Self]({links["self"]["href"]})  |  '
            f'[Transaction]({links["transaction"]["href"]})')
        await destination.send(embed=result_nfo)
    except Exception as e:
        print(e)
        raise
Exemplo n.º 21
0
    async def logging(self, ctx, toggle: bool = None):
        """Toggles the user's data logging status on or off

        The logging command can be used as follows:
            ;logging True  -> turns on logging
            ;logging False -> turns off logging

        Other valid boolean values for toggle include "t", "f", "1", "0", "yes", "no",
        "y", "n", "on", and "off".

        If the user has logging turned on, the number of times they leave a game will be
        logged if they decide to end a game early. However, information about wins and
        losses will be logged if they finish the game. Nothing will be logged if the
        user has logging turned off.

        Logging is disabled for custom mode.
        """

        if not self.manager.user_in_db(ctx):
            return await ctx.send(embed=discord.Embed(
                description="You do not exist in the database",
                color=Colour.red()))

        if toggle is None:
            return await ctx.send(embed=discord.Embed(
                description="Please specify a proper boolean value",
                color=Colour.red()))

        self.manager.update(ctx, 0, logging=toggle)
        await ctx.send(
            ctx.author.mention,
            embed=discord.Embed(
                description=f"Successfully set logging status to `{toggle}`",
                color=Colour.green()))
Exemplo n.º 22
0
	async def _command_unlink(self, ctx):
		db = await self.bot.db.get_member(ctx.author.id)
		uuid = db['uuid']
		if not db or not uuid:
			raise commands.CommandError(message="You currently aren't linked to a Minecraft account!")

		name = await minecraft.get_name(uuid)
		avatar_file = await minecraft.get_avatar(uuid)  # Get the avatar

		# Generate the embed
		embed = Embed(
			title="Unlink Confirmation",
			description="Are you sure you want to unlink your Minecraft account?",
			colour=Colour.red()
		)
		embed.set_thumbnail(url=f"attachment://{uuid}.png")
		embed.add_field(name="Name:", value=name.lower())
		embed.add_field(name="UUID:", value=uuid)

		# Wait for the user to confirm
		if not await presets.generate_confirming(ctx, await ctx.send(embed=embed, file=avatar_file)):
			return

		# Unlink the UUID
		await self.bot.db.link_member_to_minecraft(ctx.author.id, "")

		# Send the good? news
		embed = Embed(
			title="Unlink Successful!",
			description=f"You are now unlinked from the {name.lower()} Minecraft account.",
			colour=Colour.green()
		)
		embed.add_field(name="Name:", value=name.lower())
		await ctx.send(embed=embed)
Exemplo n.º 23
0
 async def buy(self, ctx, item):
     if item.casefold() == "rig":
         if user.get_cash(ctx.author) < settings.RIG_PRICE:
             embed = Embed(
                 title="You don't have enough money to buy your first rig!",
                 description="**TIP:** `!mine` to earn easy cash.",
                 colour=Colour.red()
             )
             await ctx.send(embed=embed)
             return
         uid = user.get_uid(ctx.author)
         query = """
             INSERT
             INTO
             crypto(
                 uid,
                 crypto_rig,
                 crypto_wallet,
                 crypto_currency
             )
             VALUES(?, ?, ?, ?)
         """
         Connection.SQL_Cursor.execute(query, (uid, 1, 0, 0))
         Connection.SQL_Handle.commit()
         embed = Embed(
             title="Success",
             description="You have bought a rig! You can now start mining for crypto currencies.",
             colour=Colour.green()
         )
         embed.add_field(
             name=emojii.special["empty"],
             value="**TIP:** You can now use `!crypto download wallet` to download your crypto wallet.",
             inline=True
         )
         await ctx.send(embed=embed)
Exemplo n.º 24
0
    async def load_module_command(self, ctx, module_path: str):
        """Load the specified module."""

        if module_path in (m.name for m in self.consumer.modules):
            error_info_embed = Embed(
                title=f"Failed to load module `{module_path}`:",
                description=(
                    "Module is already loaded. "
                    "Use `reload` if you want to reload it."
                ),
                colour=Colour.red(),
            )
            return await ctx.send(embed=error_info_embed)

        try:
            await self.nerodia.load_module(module_path)
        except ValueError as e:
            error_info_embed = Embed(
                title=f"Failed to load module `{module_path}`:",
                description=str(e),
                colour=Colour.red(),
            )
            await ctx.send(embed=error_info_embed)
        else:
            success_embed = Embed(
                description=f"Successfully loaded module `{module_path}`.",
                colour=Colour.green(),
            )
            await ctx.send(embed=success_embed)
Exemplo n.º 25
0
    async def voice(self, ctx, *, alias: str = ''):
        """
        Modifies/displays voice profile information of the command invoker.

        parameter:
            ctx [Context]: context object representing command invocation
            alias   [str] (default=''): name of command invoker's new voice
        """
        member = ctx.author.display_name

        # Check if an alias was provided
        if not alias:
            # Retrieve command invoker's current alias
            alias = self.voice_profiles[(ctx.author, ctx.channel)]

            prefix = self.prefixes[ctx.guild]
            embed = Embed(title=":gear: **Voice Settings**",
                          colour=Colour.gold())
            embed.add_field(name=f"**{member}'s Current Voice:**",
                            value=f"`{alias}`",
                            inline=False)
            embed.add_field(name="**Update Voice:**",
                            value=f"`{prefix}voice [New Voice]`",
                            inline=False)
        elif await voice_is_valid(alias):
            # Set the command invoker's new alias
            self.voice_profiles[(ctx.author, ctx.channel)] = alias
            embed = Embed(
                title=(f":white_check_mark: **{member}'s new voice is **"
                       f"`{alias}`"),
                colour=Colour.green())

        await ctx.send(embed=embed)
Exemplo n.º 26
0
    async def google(self, ctx: commands.Context, *request):
        if not request:
            return await ctx.send(f"Veuillez entrer la commande `{ctx.prefix}help {ctx.command.name}` pour obtenir plus d'informations sur la commande")

        r = " ".join(list(request))
        async with ctx.channel.typing():
            google = search(r, tld="fr", num=10, stop=5, pause=2, lang="fr")
            links = []
            search_embed = Embed(color=Colour.green(),
                                 timestamp=datetime.utcnow())
            search_embed.set_author(name=r.title())
            titles = []

            for link in google:
                links.append(link)
                requete = requests.get(link)
                page = requete.content
                soup = BeautifulSoup(page, features="html.parser")
                h1 = soup.find("title")
                h1 = h1.string.strip()
                titles.append(h1)

            values = []
            for i in range(len(links)):
                values.append(f"[{titles[i]}]({links[i]})")

            search_embed.add_field(name="Liens", value="\n".join(values))

        await ctx.send(embed=search_embed)
Exemplo n.º 27
0
        async def genesis_of_todo_list():
            """
            After the delay is complete, this function will execute.
            """

            if task_type == "todo_list":
                update_of_todos(ctx=ctx, todos=todos)
                embed_msg = Embed(
                    title=f"{ctx.author}, your todo list is ready!",
                    color=Colour.green(),
                )
                await ctx.send(embed=embed_msg)

                self.add_to_todo_list_tasks[ctx.author.id] -= 1

            elif task_type == "delete_todos":
                seek = deletion_of_todos(ctx=ctx, keys_to_delete=todos)
                if seek:
                    embed_msg = Embed(
                        title=f"{ctx.author}, todos have been deleted",
                        description="Please check using `.showtodos`. Woof!",
                    )
                    await ctx.send(embed=embed_msg)
                else:
                    embed_msg = Embed(
                        title=f"{ctx.author}, failed to delete.",
                        description=
                        "Probably file failed to initialize or you have not created a todo list, "
                        "yet.\nPlease check using `.show_todos`. Woof!",
                    )
                    await ctx.send(embed=embed_msg)

                self.delete_from_todo_list_tasks[ctx.author.id] -= 1
Exemplo n.º 28
0
async def send_countdown_msg(session: Session, title: str):
    title += '\u2800' * max((18 - len(title)), 0)
    embed = Embed(title=title,
                  description=f'{session.timer.time_remaining_to_str()} left!',
                  colour=Colour.green())
    session.bot_start_msg = await session.ctx.send(embed=embed)
    await session.bot_start_msg.pin()
Exemplo n.º 29
0
async def lookup(ctx, term: str):
    if len(term) >= 3:
        results_of_lookup = dnd5e.lookup_term(term)
        if results_of_lookup:
            embedded_results = Embed(color=Colour.green(),
                                     description=results_of_lookup)
            await ctx.send(embed=embedded_results)
            url = 'https://roll20.net/compendium/dnd5e/searchbook/?terms={0}'.format(
                term)
            r = requests.get(url, allow_redirects=False)
            if r.status_code == 302:
                embedded_ref = Embed(color=Colour.blue(),
                                     description='Online reference found: ' +
                                     r.headers['location'])
                await ctx.send(embed=embedded_ref)
        else:
            embedded_err = Embed(
                color=Colour.red(),
                description=
                'search param yeilded no results in PHB or DMG index')
            await ctx.send(embed=embedded_err)
    else:
        embedded_err_len = Embed(
            color=Colour.red(),
            description='search param should be at least 3 characters')
        await ctx.send(embed=embedded_err_len)
Exemplo n.º 30
0
 async def on_member_remove(self, member):
     user = member
     emb = Embed(title="Member Left", colour=Colour.green())
     emb.add_field(name="Member:", value=member.name, inline=True)
     emb.set_thumbnail(url=user.avatar_url)
     logchannel = self.bot.memberlogs_channel
     await logchannel.send("", embed=emb)