async def xdr_data_to_embed(destination, data: dict):
    xdr_nfo = Embed(
        title=
        ":regional_indicator_x: :regional_indicator_d: :regional_indicator_r:",
        description="Bellow are details from provided XDR",
        colour=Colour.orange())
    xdr_nfo.add_field(
        name=f':money_with_wings: Transaction fee :money_with_wings: ',
        value=f'`{data["fee"]} XLM`')
    xdr_nfo.add_field(name=f':abacus:  Transaction Sequence :abacus: ',
                      value=f'`{data["txSequence"]}`')
    xdr_nfo.add_field(name=f':map:  Source Account :map: ',
                      value=f'```{data["from"]}```',
                      inline=False)

    await destination.send(embed=xdr_nfo)

    for op in data["operations"]:
        op_data = Embed(title=f'{op["type"].capitalize()} operation',
                        colour=Colour.orange())
        op_data.add_field(name=f':map: Destination :map:',
                          value=f'```{op["to"]}```',
                          inline=False)
        op_data.add_field(name=f':moneybag:  Amount :moneybag: ',
                          value=f'`{op["amount"]} {op["code"]}`',
                          inline=False)
        op_data.add_field(
            name=f':gem: Asset :gem: ',
            value=f':bank: Issuer :bank: :\n```{op["issuer"]}```')

        await destination.send(embed=op_data)
Beispiel #2
0
 async def create_blank_role(self, ctx, role):
     await ctx.guild.create_role(
         name=role,
         colour=Colour.orange(),
         mentionable=True,
         reason=f"Blank role created by GAF Bot, invoked by {ctx.author}")
     await ctx.send("Created blank role :pencil:")
 def __init__(self, title="", description=""):
     super().__init__()
     self.timestamp = datetime.utcnow()
     self.colour = Colour.orange()
     self.url = "https://github.com/bundestagsBot/bundestagsBotAnalyzer"
     self.title = title
     self.description = description
Beispiel #4
0
    async def UpdateLeaderBoard(self, ctx):

        # Declare some key variables #
        strGuildID = str(ctx.guild.id)

        # Get teams and there money ordered highest to lowest #
        dbcursor.execute(
            f"SELECT id, money FROM tbl_{strGuildID} ORDER BY money DESC")
        lisLeaderBoard = dbcursor.fetchall()
        emLeaderBoard = embeds.Embed(title='Leaderboard!',
                                     color=Colour.orange())
        i = 1
        for item in lisLeaderBoard:

            # Add to embed #
            emLeaderBoard.add_field(name=f'{i}. {item[0]}',
                                    value=f'Money: {item[1]}',
                                    inline=False)
            i = i + 1

        # Get the properties channel #
        catMonopolyRun = utils.get(ctx.guild.categories, name='Monopoly Run')
        chaLeaderBoard = utils.get(ctx.guild.channels,
                                   name='leaderboard',
                                   category_id=catMonopolyRun.id)

        # Remove last message #
        await chaLeaderBoard.purge(limit=2)

        # Send the embed #
        await chaLeaderBoard.send(embed=emLeaderBoard)
async def send_transaction_report(destination, response: dict):
    """
    Send basic transaction details once transaction successfully processed
    """
    tx_report = Embed(
        title=f':white_check_mark: Transactions Successfully Completed :white_check_mark:',
        description=f"Paging Token {response['paging_token']}",
        color=Colour.orange(),
        timestamp=datetime.utcnow())
    tx_report.add_field(name=f':calendar: Created At :calendar: ',
                        value=f'`{response["created_at"]}`')
    tx_report.add_field(name=f':ledger: Ledger :ledger: ',
                        value=f'`{response["ledger"]}`')
    tx_report.add_field(name=f':compass: Memo Details :compass:'******'`{response["memo"]}`')
    tx_report.add_field(name=f':money_with_wings:  Network Fee Charged :money_with_wings: ',
                        value=f"{int(response['fee_charged']) / (10 ** 7):7f} XLM")
    tx_report.add_field(name=f':hash: Transaction Hash :hash:',
                        value=f'```{response["hash"]}```',
                        inline=False)
    tx_report.add_field(name=f':wrench: Operation Count :wrench:',
                        value=f'`{response["operation_count"]}`',
                        inline=False)
    tx_report.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"]})\n')
    await destination.send(embed=tx_report)
Beispiel #6
0
    async def clearwarns(self, ctx, member: Member):
        """Clear all of someone's warns. (Staff only)"""
        try:
            member = ctx.message.mentions[0]
        except IndexError:
            return await ctx.send("Please mention a user.")

        with open("database/warns.json", "r") as f:
            js = load(f)

        if member == ctx.message.author and (self.bot.owner_role
                                             not in ctx.message.author.roles):
            return await ctx.send("You cannot clear your own warns!")
        if (self.bot.admin_role in member.roles
                and self.bot.owner_role not in ctx.message.author.roles):
            return await ctx.send("You cannot clear another staffer's warns")
        try:
            js.pop(str(member.id))
            await ctx.send("Cleared all of {}'s warns!".format(member.mention))
            emb = Embed(title="Member Warns Cleared", colour=Colour.orange())
            emb.add_field(name="Member:", value=member, inline=True)
            emb.add_field(name="Mod:", value=ctx.message.author, inline=True)
            logchannel = self.bot.logs_channel
            await logchannel.send("", embed=emb)
            with open("database/warns.json", "w") as f:
                dump(js, f, sort_keys=True, indent=4, separators=(',', ': '))
        except KeyError:
            return await ctx.send("This user doesn't have any warns!")
Beispiel #7
0
class WebhookHandler(logging.Handler):
    _colours = {
        logging.DEBUG: Colour.light_grey(),
        logging.INFO: Colour.gold(),
        logging.WARNING: Colour.orange(),
        logging.ERROR: Colour.red(),
        logging.CRITICAL: Colour.dark_red()
    }

    def __init__(self, webhook_url, level=logging.NOTSET):
        super().__init__(level)
        self._webhook_logger = EmbedWebhookLogger(webhook_url)

    def emit(self, record: logging.LogRecord):
        self.format(record)

        message = f'{record.message}\n{record.exc_text or ""}'
        message = message[:1987] + '...' if len(message) > 1987 else message

        self._webhook_logger.log(
            Embed(colour=self._colours.get(record.levelno),
                  title=record.name,
                  description=f'```py\n{message}\n```',
                  timestamp=datetime.datetime.fromtimestamp(
                      record.created)).add_field(
                          name=ZWSP,
                          value=f'{record.filename}:{record.lineno}'))
Beispiel #8
0
    async def define_winner(self, message_reaction, message_author, message):
        bot = self.ctx.bot
        if (message_author != bot.user
                and message_reaction.message.id == message.id
                and message_reaction.emoji in bot_constants.JOKENPO_PIECES):
            pc_choice, user_choice = choice(
                bot_constants.JOKENPO_PIECES), message_reaction.emoji
            pcwin = user_choice == self.jokenpo_winning_elements[pc_choice]
            userwin = pc_choice == self.jokenpo_winning_elements[user_choice]

            embed = Embed()
            embed.add_field(name='Você escolheu', value=user_choice)
            embed.add_field(name='O computador escolheu', value=pc_choice)

            if userwin and not pcwin:
                embed.title = 'Vencedor'
                embed.description = 'O vencedor foi você!! Parabéns'
                embed.colour = Colour.dark_green()
            elif pcwin and not userwin:
                embed.title = 'Perdedor'
                embed.description = 'O computador levou a melhor dessa vez, tende de novo!'
                embed.colour = Colour.dark_red()
            else:
                embed.title = 'Empate'
                embed.description = 'Mentes brilhantes pensam igual, foi um empate!'
                embed.colour = Colour.orange()
            await handler.edit_message(message, logger, embed=embed)
Beispiel #9
0
    async def _generate_embed(self,
                              exercise: Exercise,
                              is_reminder=False) -> Embed:
        title = (f'Abgabe in 1h: {exercise.title}'
                 if is_reminder else f'Neue Aufgabe: {exercise.title}')
        embed = Embed(
            title=title,
            type='rich',
            colour=Colour.orange() if is_reminder else Colour.dark_purple(),
            url=exercise.url,
        )

        embed.set_author(name=exercise.author)

        if len(exercise.message) > 1022:
            exercise.message = exercise.message[1018:] + '*...*'
        embed.add_field(
            name='Nachricht',
            value=exercise.message,
        )
        embed.add_field(
            name='Abgabetermin',
            value=exercise.end_date.strftime(self.datetime_format),
        )
        embed.set_footer(text=self.bot.signature)

        return embed
Beispiel #10
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)
Beispiel #11
0
    def _get_colour(self) -> Colour:
        try:
            last_title = self.__incidentdata.fields[-1].name
            status = last_title.split(" ")[0].lower()

            if status == "identified":
                return Colour.red()
            elif status in [
                    "update",
                    "monitoring",
                    "investigating",
                    "scheduled",  # decided to put this in orange as is in future, not now
                    "in",  # scheduled - full is "in progress"
                    "verifying",
            ]:
                return Colour.orange()
            elif status in ["resolved", "completed"]:
                return Colour.green()
            else:
                return Colour(1812720)
        except Exception:  # hopefully never happens but will keep this for a while
            _log.warning(
                f"Error with getting correct colour for {self.__service}. The update will still "
                "be sent.",
                exc_info=True,
            )
            return Colour(1812720)
async def third_level_own_reg_info(destination):
    intro_info = Embed(
        title=f':three: 3nd Level Own Wallet Registration Procedure :three:',
        description=
        'Welcome to 3rd level wallet registration procedure on Crypto Link.'
        ' ',
        colour=Colour.orange())
    intro_info.add_field(
        name=f':information_source: About Level 3 :information_source: ',
        value=
        'Level 3 wallet is fully non-custodial wallet. Responsibility for private keys '
        'is completely on your side. Crypto Link stores only your public key (wallet address)'
        ' under your unique Discord ID, in order to ease operations over Discord and to allow'
        ' for interoperability. All on-chain actions are required to be signed with full'
        ' private key through Discord Dedicated commands, our Terminal application or '
        'any other app supporting importing of XDR.',
        inline=False)
    intro_info.add_field(
        name=f':envelope: Utilizing the stellar XDR (envelope) :envelope:  ',
        value=
        f'Wallet level 3 transactions/payments operate through XDR. also known as External '
        f'Data Representation, and is used throughout the Stellar network and protocol.'
        f' When user initiates transaction over Discord a XDR string will be returned'
        f' which can be later imported either through additional command for signing'
        f' or in any other app, allowing to import Transaction Envelopes (XDR). '
        f'For further refference please se'
        f' [about XDR](https://developers.stellar.org/docs/glossary/xdr/)'
        f' on Stellar web page. ',
        inline=False)
    intro_info.set_footer(
        text='This message will self destruct in 240 seconds')

    await destination.send(embed=intro_info)
Beispiel #13
0
    async def add(self, ctx, *, role: CustomRoleConverter):
        """
        Adds a role to the list that can be assigned
        """
        # Call the universal setup command to pull the roles from the DB
        role_me, role_me_lvl, role_me_roles, roles = await self.setup_role_me(
            ctx)
        if role_me == "perms":
            return

        role_me_roles = self.bot.database.get(
            ctx.guild.id, self.guild_storage.columns.role_me_roles)

        if not isinstance(role, discord.Role):
            await ctx.send(
                "Could not find role! Creating blank role now :crayon: ")
            role = await ctx.guild.create_role(
                name=role,
                colour=Colour.orange(),
                mentionable=True,
                reason="Role automagically created by GAF Bot for the role list"
            )
        if role.position >= ctx.author.top_role.position:
            await ctx.send("Unable to add role due to Hierarchy")
        else:
            role_me_roles.append(role.id)
            self.bot.database.set(ctx.guild.id,
                                  self.guild_storage.columns.role_me_roles,
                                  role_me_roles)
            await ctx.send("`Added {} to the role list`".format(role.name))
Beispiel #14
0
    async def on_raw_bulk_message_delete(self,
                                         event: RawBulkMessageDeleteEvent):
        if event.guild_id != GuildConstant.id or event.channel_id in GuildConstant.ignored:
            return

        # Could upload the log to the site - maybe we should store all the messages somewhere?
        # Currently if messages aren't in the cache, we ain't gonna have 'em.

        ignored_messages = 0

        for message_id in event.message_ids:
            if message_id in self._ignored[Event.message_delete]:
                self._ignored[Event.message_delete].remove(message_id)
                ignored_messages += 1

        if ignored_messages >= len(event.message_ids):
            return

        channel = self.bot.get_channel(event.channel_id)

        if channel.category:
            message = f"{len(event.message_ids)} deleted in {channel.category}/#{channel.name} (`{channel.id}`)"
        else:
            message = f"{len(event.message_ids)} deleted in #{channel.name} (`{channel.id}`)"

        await self.send_log_message(Icons.message_bulk_delete,
                                    Colour.orange(),
                                    "Bulk message delete",
                                    message,
                                    channel_id=Channels.devalerts,
                                    ping_everyone=True)
Beispiel #15
0
 async def close(self):
     embed = self.make_embed()
     embed.colour = Colour.orange()
     embed.description = 'Closing'
     await self.send_notification(embed=embed)
     await self.aio_sess.close()
     self.logger.debug("aiohttp session closed")
Beispiel #16
0
    async def search_reason(self, ctx: Context, reason: str):
        """
        Search for infractions by their reason. Use Re2 for matching.
        """

        try:
            response = await self.bot.http_session.get(URLs.site_infractions,
                                                       params={
                                                           "search": reason,
                                                           "hidden": "True"
                                                       },
                                                       headers=self.headers)
            infraction_list = await response.json()
        except ClientError:
            log.exception(
                f"Failed to fetch infractions matching reason `{reason}`.")
            await ctx.send(":x: An error occurred while fetching infractions.")
            return

        embed = Embed(
            title=
            f"Infractions matching `{reason}` ({len(infraction_list)} total)",
            colour=Colour.orange())

        await self.send_infraction_list(ctx, embed, infraction_list)
 async def general(self, ctx, *, message: str):
     try:
         await ctx.message.delete()
     except Exception:
         pass
     if self.length_checker(message=message):
         ticket_no = str(uuid4())
         time_of_request = datetime.utcnow()
         if support_sys_mng.check_if_support_activated(
                 community_id=ctx.guild.id):
             if await self.send_ticket_message_channel(
                     ctx=ctx,
                     message=message,
                     department='General',
                     color_code=Colour.orange(),
                     ticket_id=ticket_no,
                     time_of_request=time_of_request):
                 if await self.send_ticket_message_author(
                         ctx=ctx,
                         time_of_request=time_of_request,
                         department='Marketing',
                         ticket_id=ticket_no,
                         support_msg=message,
                         colour=Colour.magenta()):
                     return
                 else:
                     title = '__Support System Internal Error__'
                     message = f'System could deliver a copy of the ticket to your DM however support' \
                               f' has recieved it and will be in touch as soon as possible. ' \
                               f'We apologize for inconvinience!'
                     await custom_message.system_message(
                         ctx,
                         message=message,
                         color_code=1,
                         destination=1,
                         sys_msg_title=title)
             else:
                 title = '__Support System Internal Error__'
                 message = f'System could not process you request at this moment. Please try again later.' \
                           f' We apologize for inconvinience!'
                 await custom_message.system_message(ctx,
                                                     message=message,
                                                     color_code=1,
                                                     destination=1,
                                                     sys_msg_title=title)
         else:
             message = f'{ctx.guild} does not have activate support ticket service. Please contact ' \
                       f'administrators directly'
             await custom_message.system_message(ctx,
                                                 message=message,
                                                 color_code=1,
                                                 destination=1)
     else:
         message = f'Message needs to be between 20 and 200 characters in length!'
         await custom_message.system_message(ctx,
                                             message=message,
                                             color_code=1,
                                             destination=1)
Beispiel #18
0
 async def search_user(self, ctx: Context, user: Union[User,
                                                       proxy_user]) -> None:
     """Search for infractions by member."""
     infraction_list = await self.bot.api_client.get(
         'bot/infractions', params={'user__id': str(user.id)})
     embed = Embed(
         title=f"Infractions for {user} ({len(infraction_list)} total)",
         colour=Colour.orange())
     await self.send_infraction_list(ctx, embed, infraction_list)
Beispiel #19
0
 async def close(self, _app=None):
     """Cleanup"""
     embed = self.make_embed()
     embed.colour = Colour.orange()
     embed.description = 'Closing'
     await self.send_notification(embed=embed)
     self.write_jobs()
     if self.cleaner:
         self.cleaner.close()
 def get_direction_color(self, direction: int):
     if direction == 0:
         # If someone leaves or delition happens
         return Colour.red()
     elif direction == 1:
         # If someone joins and good happens
         return Colour.green()
     elif direction == 2:
         return Colour.orange()
Beispiel #21
0
 def get_broadcast_message(self) -> Embed:
     embed = Embed(colour=Colour.orange())
     embed.title = "Left 4 Dead game starting soon!"
     embed.description = (
         "Only one more player is needed for a full lobby.\n")
     for player in self.players:
         embed.description += f"• {player.get_mention()}\n"
     embed.description += f"\nJoin {self.channel.mention} to get involved!"
     return embed
Beispiel #22
0
async def start_message():
    """ Generate discord message  of start command """
    message = f"Hey! I'm Uranus, an all-in-one bot for Xiaomi users!\n" \
              "I can get you latest Official ROMs, Firmware updates links," \
              " and many more things!\n\nCheck how to use me by using !help command.\n\n"
    embed = Embed(title="Welcome!", description=message, color=Colour.orange())
    embed.add_field(name="XiaomiFirmwareUpdater website", value=f"[Here]({XFU_WEBSITE})")
    embed.add_field(name="Read help", value=f"[Here]({HELP_URL})")
    return embed
Beispiel #23
0
 async def search_reason(self, ctx: Context, reason: str) -> None:
     """Search for infractions by their reason. Use Re2 for matching."""
     infraction_list = await self.bot.api_client.get(
         'bot/infractions', params={'search': reason})
     embed = Embed(
         title=
         f"Infractions matching `{reason}` ({len(infraction_list)} total)",
         colour=Colour.orange())
     await self.send_infraction_list(ctx, embed, infraction_list)
Beispiel #24
0
async def SendWarningAsDM(ctx,
                          warning,
                          color=Colour.orange(),
                          tip="!help to see the list of commands."):
    embed = Embed(title='Warning Notification',
                  description=f'**Warning:** `{warning}`',
                  colour=color)
    embed.set_footer(text=f'Tip: {tip}')
    await ctx.author.send(embed=embed)
Beispiel #25
0
async def SendTip(ctx,
                  tip,
                  color=Colour.orange(),
                  tipper="Who knows ¯\_(ツ)_/¯"):
    embed = Embed(title='A Tip Has Arrived!',
                  description=f'**Tip:** `{tip}`',
                  colour=color)
    embed.set_footer(text=f'From: {tipper}')
    await ctx.send(embed=embed)
 async def money(self, ctx):
     emMoneyHelp = embeds.Embed(
         title='Money Command Help',
         description='Use mr money to find out how much money you have.',
         color=Colour.orange())
     emMoneyHelp.add_field(name='Usage:', value='mr money')
     emMoneyHelp.add_field(name='Example Usage:', value='mr money')
     emMoneyHelp.add_field(name='⠀', value='⠀', inline=False)
     emMoneyHelp.add_field(name='Requirements:', value='N/A')
     await ctx.send(embed=emMoneyHelp)
 async def owner(self, ctx):
     emOwnerHelp = embeds.Embed(
         title='Owner Command Help',
         description='Use mr owner to find the owner of a property.',
         color=Colour.orange())
     emOwnerHelp.add_field(name='Usage:', value='mr owner <property name>')
     emOwnerHelp.add_field(name='Example Usage:', value='mr owner pink2')
     emOwnerHelp.add_field(name='⠀', value='⠀', inline=False)
     emOwnerHelp.add_field(name='Requirements:', value='N/A')
     await ctx.send(embed=emOwnerHelp)
Beispiel #28
0
 def get_embed_list(self, table):
     embed_list = []
     field_cnt = 0
     embed = Embed(title=f"UPDATE: {str(datetime.now())[:-7]}", colour=Colour.orange())
     before_movie = ScreenTime(None)
     for i in table:
         i:ScreenTime
         if i.screen != before_movie.screen:
             embed.add_field(inline=False, name="- "*30, value=f"**{i.screen}**")
         if field_cnt > 15:
             embed_list.append(embed)
             embed = Embed(colour=Colour.orange())
             field_cnt = 0
         embed.add_field(name=f"{i.startTime} ~ {i.endTime}",
                         value=f"잔여 {i.remainSeats}석 ([LINK]({i.url}))" if i.remainSeats > 0 else "~~매진~~",
                         inline=True)
         field_cnt += 1
         before_movie = i
     embed_list.append(embed)
     return embed_list
 def __init__(self, bot: commands.Bot) -> None:
     self.bot = bot
     self.colour = Colour.orange()
     self.bot.help_command = Help(command_attrs=attributes)
     self.bot.help_command.cog = self
     self.questionArray = [
         line.replace("\n", "")
         for line in open(questionPath, "r", encoding="utf").readlines()
     ]
     self.nextQuestion = None
     self.gunLines = None
Beispiel #30
0
async def help(ctx):
    # create an embed message
    embed = Embed(colour=Colour.orange())

    # set the title
    embed.set_author(name="SRB2 Circuit Race - Help")

    embed.add_field(name="Command Prefix", value=bot.command_prefix)

    # set the commands with descriptions
    embed.add_field(name="help (alias: h)", value="Returns this message")
    embed.add_field(name="status (alias: server, serverstatus, info)",
                    value="Returns the server status",
                    inline=False)
    embed.add_field(
        name="leaderboard (alias: scoreboard)",
        value=
        f'Returns the player leaderboard, monthly or of all time\nUsage: {bot.command_prefix}leaderboard [m]',
        inline=False)
    embed.add_field(
        name="search",
        value=(f'Usage: {bot.command_prefix}search <map name> [PARAMETERS]\n'),
        inline=False)
    embed.add_field(name="bestskins",
                    value="Returns the skin leaderboard",
                    inline=False)
    embed.add_field(
        name="graph",
        value=
        f'Usage: {bot.command_prefix}graph <player> <map name> [PARAMETERS]')
    embed.add_field(name="mods", value="Returns the active mods on the server")
    embed.add_field(name="Parameters List", value="When [PARAMETERS] is usable in a command, you are able to put any of these optional parameters in whatever order you like, by using them like: *-label value*.\n"\
                                                  'All parameters can be submitted with no "" if they '"don't require spaces.\n\n"\
                                                  "*-all_scores*  : to get multiple scores from same circumstances, must use value 'on'\n"\
                                                  "*-all_skins*   : to get scores from modded skins, must use value 'on'\n"\
                                                  "*-username*       : to get scores from a specific player\n"\
                                                  "*-skin*       : to get scores from a specific skin\n"\
                                                  "*-order*      : to get scores with a specific order, default 'time'\n"\
                                                  "*-limit*      : to get a limited number of scores, max 50"
                                                  , inline=False)

    # get the command sender
    member = ctx.message.author

    # if it exists
    if member:
        # get the bot - user dm channel
        channel = member.dm_channel
        # if the dm channel hasn't yet been created
        if not channel:
            # create the dm channel
            channel = await member.create_dm()
        # send the message
        await channel.send(embed=embed)
Beispiel #31
0
    async def add(self, ctx, *, role: CustomRoleConverter):
        """
        Adds a role to the list that can be assigned
        """
        # Call the universal setup command to pull the roles from the DB
        role_me, role_me_lvl, role_me_roles, roles = await self.setup_role_me(ctx)
        if role_me == "perms":
            return

        role_me_roles = self.bot.database.get(ctx.guild.id, self.guild_storage.columns.role_me_roles)

        if not isinstance(role, discord.Role):
            await ctx.send("Could not find role! Creating blank role now :crayon: ")
            role = await ctx.guild.create_role(name=role,
                                               colour=Colour.orange(),
                                               mentionable=True,
                                               reason="Role automagically created by GAF Bot for the role list")
        if role.position >= ctx.author.top_role.position:
            await ctx.send("Unable to add role due to Hierarchy")
        else:
            role_me_roles.append(role.id)
            self.bot.database.set(ctx.guild.id, self.guild_storage.columns.role_me_roles, role_me_roles)
            await ctx.send("`Added {} to the role list`".format(role.name))
Beispiel #32
0
 async def create_blank_role(self, ctx, role):
     await ctx.guild.create_role(name=role,
                                 colour=Colour.orange(),
                                 mentionable=True,
                                 reason=f"Blank role created by GAF Bot, invoked by {ctx.author}")
     await ctx.send("Created blank role :pencil:")