async def assign(ctx):
    nprint("user requested to assign a channel")
    # check if the user can manage channels
    if not ctx.author.guild_permissions.manage_channels:
        fprint("user cannot manage channels")
        response = embeds.Embed(
            title="ASSIGNMENT FAILED",
            description=
            "```Only someone who can manage channels can use this command```",
            colour=failColor)
        await sendMessage(ctx, response)
        return
    # obtain guild ID
    try:
        sourceGID = ctx.guild.id
    except AttributeError:
        sourceGID = "No guild ID"
    # obtain channel ID
    try:
        sourceCID = ctx.channel.id
    except AttributeError:
        sourceGID = "No channel ID"
    assignResult = await addToQueue('ac', [sourceGID, sourceCID])
    if assignResult:
        response = embeds.Embed(
            title="REQUEST SUCCESSFUL",
            description="```Request to assign channel successful```",
            colour=successColor)
    else:
        response = embeds.Embed(
            title="REQUEST FAILED",
            description="```Server/channel couldn't be found```",
            colour=failColor)
    await sendMessage(ctx, response)
async def stop(ctx):
    nprint("user requested to stop watching bots")
    # check if the user can manage channels
    if not ctx.author.guild_permissions.manage_channels:
        fprint("user cannot manage channels")
        response = embeds.Embed(
            title="STOP FAILED",
            description=
            "```Only someone who can manage channels can use this command```",
            colour=failColor)
        await sendMessage(ctx, response)
        return
    # obtain guild ID
    try:
        sourceGID = ctx.guild.id
    except AttributeError:
        sourceGID = "No guild ID"
    assignResult = await addToQueue('rg', [sourceGID])
    if assignResult:
        response = embeds.Embed(
            title="REQUEST SUCCESSFUL",
            description="```Request to stop watching successful```",
            colour=successColor)
    else:
        response = embeds.Embed(title="REQUEST FAILED",
                                description="```Unknown error```",
                                colour=failColor)
    await sendMessage(ctx, response)
Esempio n. 3
0
 async def Leaderboard(self, ctx):
     data = " ".join(ctx.message.content.split(" ")[1:]).lower()
     if data == "":
         msg = database().highScores()
         emb = embeds.Embed(title="Server Leaderboard",
                            description=msg,
                            color=0x9b59b6)
         emb.set_thumbnail(url=self.icons[0])
         await self.bot.say(embed=emb)
         return
     try:
         msg = ""
         skillName = data.capitalize()
         data = database().leaderBoard(data)
         for x in range(0, len(data)):
             msg += "`" + data[x][0] + (
                 "." *
                 (20 - len(data[x][0]))) + "Lvl: " + str(data[x][2]) + (
                     " " * (4 - len(str(data[x][2])))
                 ) + " XP: " + "{:,}`\n".format(int(data[x][1]))
         emb = embeds.Embed(title="{} Leaderboard:".format(skillName),
                            description=msg,
                            color=0x9b59b6)
         emb.set_thumbnail(url=self.icons[self.labels.index(skillName)])
         await self.bot.say(embed=emb)
         return
     except ValueError:
         await self.bot.say("That skill was not found")
         return
Esempio n. 4
0
    async def dice(self, message):
        """
        Roll some dice for the user with an optional reason.

        :param message: a discord.py Message object
        """
        dstr = message.content.split()[1]
        if 'd' not in dstr:
            await self.bot.send_message(
                message.channel,
                "Use this command like: <prefix>roll xdy <reason>")

        if dstr.split('d')[0] == '':
            dice = 1
            try:
                int(dstr.split('d')[1])
            except ValueError:
                await self.bot.send_message(
                    message.channel,
                    "Number of sides on the dice must be a number.")
                return
        else:
            try:
                dice, sides = int(dstr.split('d')[0]), int(dstr.split('d')[1])
            except ValueError:
                await self.bot.send_message(
                    message.channel,
                    "Number of sides and number of dice must be a number.")
                return

        results = []
        for die in range(dice):
            results.append(randint(1, sides))

        reason_msg = None
        if len(message.content.split()) > 2:
            reason_msg = " ".join(message.content.split()[2:])

        if reason_msg:
            embed = embeds.Embed(description=reason_msg)
        else:
            embed = embeds.Embed()
        embed.title = "Rolled dice for {}".format(message.author)
        embed.add_field(name="Number Rolled", value=dice)
        embed.add_field(name="Type of Dice", value="d{}".format(sides))
        embed.add_field(name="Dice Rolls",
                        value=" ".join(str(x) for x in results))
        embed.add_field(name="Sum of Rolls", value=sum(results))
        await self.bot.send_message(message.channel, embed=embed)
Esempio n. 5
0
    async def display_meter_stat_for_user(self, ctx: SlashContext,
                                          player: str):
        try:
            await ctx.defer()
            participant_id = utils.get_id_from_tag(self.bot, player)
            participant_summary = self.meters.get_participant_summary(
                participant_id)

            message = embeds.Embed(
                title=participant_summary['nom'],
                colour=EMBEDDED_COLOR).set_footer(
                    text=EMBEDDED_FOOTER).add_field(
                        name='total score',
                        value=participant_summary['total_score'],
                        inline=False)
            for elt in participant_summary['meters']:
                message.add_field(name=elt['name'],
                                  value=elt['score'],
                                  inline=False)

            await utils.send_embedded(self.meters_channel(), message)
            await utils.send_empty_message(ctx)

        except msqerror.MSQbotError:
            logging.exception(ERROR_NAME, exc_info=True)

        except meter_error.ParticipantNotFound as e:
            await utils.send_success(ctx, e.message)

        except commands.errors.MissingRequiredArgument:
            await utils.send_error(ctx, msqerror.NoParameterGiven().message)
    async def movie_details(self, ctx: SlashContext, title: str):
        try:
            await ctx.defer()
            details = self.movie.get_movie_rates(title)

            embed_msg = embeds.Embed(
                title="{} - {}".format(details["name"],
                                       details["averageRate"]),
                description="seen : " +
                self.__convert_movie_date__(details["seen"]),
                colour=EMBEDDED_COLOR)
            for detail in details["spectatorRates"]:
                embed_msg.add_field(name=detail["spectator"],
                                    value=detail["rate"],
                                    inline=False)

            await utils.send_embedded(self.movie_channel(), embed_msg)
            await utils.send_empty_message(ctx)

        except msqbot_error.MsqDataBaseError:
            logging.exception(ERROR_PREFIX, exc_info=True)
            await utils.send_error(ctx, msqbot_error.MSQbotError().message)

        except movie_error.NoMovieFound as e:
            await utils.send_error(ctx, e.message)

        except commands.errors.MissingRequiredArgument:
            await utils.send_error(ctx,
                                   msqbot_error.NoParameterGiven().message)
    async def too_watch_movies(self, ctx: SlashContext):
        try:
            await ctx.defer()
            movies = self.movie.get_unseen_movie()
            paginator = CustomPaginator()
            paged_movies = paginator.divide_into_page(movies)
            embeds_pages = []

            for page in paged_movies:
                embed_msg = embeds.Embed(
                    title="To Watch List",
                    description="movies yet to be seen",
                    colour=EMBEDDED_COLOR).set_footer(text="{}/{}".format(
                        paged_movies.index(page) + 1, paginator.nb_pages + 1))
                for movie in page:
                    embed_msg.add_field(name=movie["name"],
                                        value="added: {}".format(
                                            self.__convert_movie_date__(
                                                movie["added"])),
                                        inline=False)
                embeds_pages.append(embed_msg)

            await paginator.start(ctx, embeds_pages)
            await utils.send_empty_message(ctx)

        except msqbot_error.MsqDataBaseError:
            logging.exception(ERROR_PREFIX, exc_info=True)
            await utils.send_error(ctx, msqbot_error.MSQbotError().message)

        except movie_error.NoUnseenMovieFound as e:
            await utils.send_success(ctx, e.message)
Esempio n. 8
0
    async def define(self, ctx, *, phrase: str):

        try:
            with ctx.typing():
                results: typing.List[dict] = await self._lookup(phrase)
        except errors.NotFound as ex:
            return await ctx.send(str(ex), delete_after=10)

        pages = []

        for result in results:
            extended_text = ellipse(result.get("extendedText", None))
            source = result.get("attributionText", result["sourceDictionary"])
            citations = [
                f'{quote(c["cite"])} - {c["source"]}'
                for c in result.get("citations", []) if c["cite"]
            ]
            citations = ellipse("\n\n".join(citations))
            examples = [e["text"] for e in result.get("exampleUses", [])]
            # Capitalise each example, and quote it.
            examples = [quote(e) for e in examples]
            examples = ellipse("\n\n".join(examples))
            title = result["word"].upper()
            part_of_speech = result.get("partOfSpeech", None)
            definition = result.get("text", "_No definition_")
            if part_of_speech:
                definition = "**" + part_of_speech + "**: " + definition
            definition = ellipse(definition, 2000)

            # Maps relation type to sets of words.
            related = {}
            for rel_word in result.get("relatedWords", []):
                rwl = related.setdefault(rel_word["relationshipType"], set())
                for word in rel_word["words"]:
                    rwl.add(word.title())

            embed = embeds.Embed(title=title,
                                 description=definition,
                                 colour=alg.rand_colour())

            embed.set_footer(text=source)

            if extended_text:
                embed.add_field(name="Extended definition",
                                value=extended_text)

            if citations:
                embed.add_field(name="Citations", value=citations)

            if examples:
                embed.add_field(name="Examples", value=examples)

            if related:
                for relation, words in related.items():
                    embed.add_field(name=f"{relation}s".title(),
                                    value=", ".join(words))

            pages.append(embed)

        book.EmbedBooklet(ctx=ctx, pages=pages).start()
Esempio n. 9
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 stats(ctx):
    nprint("user requested to display stats")
    statsColor = embeds.Colour.from_rgb(114, 137, 218)

    with open('activeServers.json') as readFile:
        serverJson = json.load(readFile)

    # CALCULATE TOTALS
    totalServers = len(bot.guilds)
    totalActive = len(serverJson)
    totalBots = 0
    for GID in serverJson:
        for BID in serverJson[GID]['bots']:
            totalBots += 1

    # CALCULATE UPTIME
    currentTime = time.time()
    diff = currentTime - startTime
    uptime = time.gmtime(diff)

    # MAKE EMBED
    statsEmbed = embeds.Embed(title="OfflineNotifier stats", colour=statsColor)
    statsEmbed.timestamp = datetime.utcnow()
    statsEmbed.add_field(name="Total servers", value=f"```{totalServers}```")
    statsEmbed.add_field(name="Active servers", value=f"```{totalActive}```")
    statsEmbed.add_field(name="Bots watching", value=f"```{totalBots}```")
    statsEmbed.add_field(
        name="Uptime",
        value=
        f"```{(uptime.tm_yday - 1) * (uptime.tm_year - 1969)}D {uptime.tm_hour}H {uptime.tm_min}M {uptime.tm_sec}S```"
    )
    await sendMessage(ctx, statsEmbed)
Esempio n. 11
0
 async def GE(self, ctx):
     # Get the name of the item that they are looking for and store it in "item"
     item = " ".join(ctx.message.content.split(" ")[1:]).lower()
     # Attempts to use the offical osrs item values
     # If there is an index error returned then we will state that that item could not be found
     try:
         sauce = requests.get("http://services.runescape.com/m=itemdb_oldschool/api/catalogue/items.json?category=1&alpha={}".format(item)).json()
         sauce = requests.get("http://services.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item={}".format(sauce['items'][0]['id'])).json()
     except IndexError:
         await self.bot.say(item + " not found")
         return
     # Append all of the proper information to the message so that it can be placed inside of an embed
     msg = "**Current Price:**\n" + str(sauce['item']['current']['price']) + " gp\n"
     msg += "**Today's Change:**\n" + str(sauce['item']['today']['price']).replace(' ','') + " gp\n"
     msg += "**30 Day Trend:**\n" + str(sauce['item']['day30']['change']) + "\n"
     # Simple check to see if the change in price is positive or negative, sets the embed color to reflect that
     if str(sauce['item']['day30']['change']).startswith("+"):
         color = 0x2ecc71
     elif str(sauce['item']['day30']['change']).startswith("-"):
         color = 0xe74c3c
     else:
         color = 0x3498db
     # Creates an embed with the title as the item, the inforamation as the contents, and the color as the side bar
     emb = embeds.Embed(title=sauce['item']['name'], description=msg, color=color)
     # Gets the icon from the sauce and sets it as the thumbnail
     emb.set_thumbnail(url=sauce['item']['icon'])
     # Puts the description as the embed description and then sends it off
     emb.set_footer(text=sauce['item']['description'])
     await self.bot.say(embed=emb)
     return
Esempio n. 12
0
    async def embed_book(self, ctx, everyone_can_edit=False):
        """
        Produces multiple pages, and displays them to the author only.
        """
        # Generate our pages first. This is so that Discord doesn't complain
        # of messages being too large. This is just a reference to Danny's
        # paginator implementation for now.
        paginator = pag.RapptzPaginator(prefix="", suffix="", max_size=2048)

        for line in lipsum.lorem_ipsum.splitlines():
            paginator.add_line(line)

        embed_pages = []
        for page in paginator.pages:
            embed_pages.append(
                embeds.Embed(
                    title="Just an example",
                    description=page,
                    colour=randint(0, 0xFFFFFF),
                ))

        # Create our book state machine
        b = book.EmbedBooklet(pages=embed_pages,
                              ctx=ctx,
                              timeout=100,
                              only_author=not everyone_can_edit)

        await b.start()
Esempio n. 13
0
def format_build(champ: str, build_dict: dict):
    title = champ.upper() + " BUILD :crossed_swords:"
    embed = embeds.Embed(
        title=title,
        colour=Colour.random()
    )

    txt = ""
    count = 0
    for item in build_dict["core-build"]:
        if count < 3:
            txt += str(count+1) + '. ' + item + '\n\n'
        elif count == 3:
            txt += "\nPopularidade: " + item + "%\n"
        else:
            txt += " Win rate: " + item + "%\n"
        count += 1

    embed.add_field(name="Principal", value=txt, inline=True)

    txt = ''
    for item in build_dict["end-build"]:
        txt += item + '\n'

    txt += "\n**Bota**\n"
    info_botas = build_dict['boots']
    txt += info_botas[0] + '\n\n'
    txt += " Popularidade: " + info_botas[1] + "%\n"
    txt += " Win rate: " + info_botas[2] + "%\n"

    embed.add_field(name="Outros", value=txt, inline=True)

    return embed
Esempio n. 14
0
 async def owheroes(self, message):
     name = " ".join(message.content.split(" ")[1:]).replace('#', '-')
     with aiohttp.ClientSession() as session:
         async with session.get(self.apiurl + "{}/heroes".format(name),
                                headers=self.header) as response:
             if response.status == 404:
                 await self.bot.send_message(message.channel,
                                             "Battletag not found.")
             elif response.status == 500:
                 await self.bot.send_message(
                     message.channel,
                     "Server under heavy load. Please try again later.")
             else:
                 jsd = await response.json()
                 region = 'us' if 'us' in jsd and jsd[
                     'us'] is not None else 'eu' if 'eu' in jsd and jsd[
                         'eu'] is not None else 'kr'
                 embed = embeds.Embed(description="Hero Playtime in Hours")
                 embed.title = name.replace("-", "#")
                 for hero in [
                         x for x in jsd[region]['heroes']['playtime']
                     ['quickplay'] if jsd[region]['heroes']['playtime']
                     ['quickplay'][x] > 0
                 ]:
                     embed.add_field(name=hero,
                                     value=round(
                                         jsd[region]['heroes']['playtime']
                                         ['quickplay'][hero], 2))
                 await self.bot.send_message(message.channel, embed=embed)
Esempio n. 15
0
async def stats(ctx):
    statsColor = embeds.Colour.from_rgb(114, 137, 218)

    with open('activeServersPY.json') as readFile:
        serverJson = json.load(readFile)

    # CALCULATE TOTALS
    totalServers = len(bot.guilds)
    totalActive = len(serverJson)
    totalBots = 0
    for GID in serverJson:
        for BID in serverJson[GID]['bots']:
            totalBots += 1

    # CALCULATE UPTIME
    uptime = await calculateDeltaTime(startTime)

    # MAKE EMBED
    statsEmbed = embeds.Embed(title="OfflineNotifier stats", colour=statsColor)
    statsEmbed.set_footer(text="Last heartbeat")
    statsEmbed.timestamp = lastBeat
    statsEmbed.add_field(name="Total servers", value=f"```{totalServers}```")
    statsEmbed.add_field(name="Active servers", value=f"```{totalActive}```")
    statsEmbed.add_field(name="Bots watching", value=f"```{totalBots}```")
    statsEmbed.add_field(name="Bot version", value=f"```{botVersion}```")
    statsEmbed.add_field(name="Uptime", value=f"```{(uptime.tm_yday - 1) * (uptime.tm_year - 1969)}D {uptime.tm_hour}H {uptime.tm_min}M {uptime.tm_sec}S```")
    await sendMessage(ctx, statsEmbed)
Esempio n. 16
0
    async def add(self, ctx, *, time):
        """
        Adds <time> to the current eve time
        """
        async with ctx.typing():
            await asyncio.sleep(.5)
            parsedtime = dateparser.parse(time,
                                          settings={
                                              'TIMEZONE': 'UTC',
                                              'PREFER_DATES_FROM': 'future'
                                          })
            if not parsedtime:
                raise commands.BadArgument(
                    'Sorry, I cannot process that time argument')

            now = pendulum.now(tz='UTC')
            newtime = now + now.diff(parsedtime)

            timeadd = embeds.Embed()
            timeadd.add_field(
                name='Current EVE Time:',
                value=pendulum.now(tz='UTC').to_datetime_string(),
                inline=False)
            timeadd.add_field(name='New EVE Time:',
                              value=newtime.to_datetime_string(),
                              inline=False)

            return await ctx.send(embed=timeadd)
Esempio n. 17
0
    async def RemindUser(self, delete=True):
        if delete:
            reminder: Reminder = self.GetReminder()
        else:
            reminder: Reminder = self.PeekReminder()

        dt = reminder.dateTime
        channel = self.bot.get_channel(reminder.channelID)
        message = reminder.content.text
        remindType = reminder.remindType
        user = await self.bot.fetch_user(reminder.userID)
        title = f"Your reminder is here, {user.name}!"
        link = reminder.content.link

        desc = []
        if remindType == RemindType.String:
            desc.append("<< " + message + " >>")
        desc.append(reminder.content.link)
        desc.append(user.mention)
        desc = '\n'.join(desc)

        embed = None
        embed = embeds.Embed(title=title, description=desc)
        embed.set_footer(text=dt.strftime("%x %X"))
        await channel.send(embed=embed)

        self.SaveReminderFile()
Esempio n. 18
0
async def invite(ctx):
    inviteColor = embeds.Colour.from_rgb(114, 137, 218)

    # creating and sending invite
    inviteEmbed = embeds.Embed(title="Want OfflineNotifier in your server? Use this link!", url=inviteLink, colour=inviteColor)
    user = bot.get_user(int(ctx.message.author.id))
    DM = await user.create_dm()
    await sendMessage(DM, inviteEmbed)
Esempio n. 19
0
async def on_command_error(ctx, error):
    if isinstance(error, commands.errors.CommandNotFound):
        return
    elif isinstance(error, commands.errors.NoPrivateMessage):
        response = embeds.Embed(title="COMMAND FAILED", description="```You can only use this command in a server```", colour=failColor)
        await sendMessage(ctx, response)
        return
    raise error
Esempio n. 20
0
 async def Clan(self, ctx):
     info = database().datelist()
     msg = ''
     for x in range(0,len(info)):
         msg += "`" + info[x][0] + "."*(20-len(info[x][0])) + info[x][1] + "`\n"
     emb = embeds.Embed(title='**Earliest Known Register Dates:**', description=msg, color=0x11806a)
     await self.bot.say(embed=emb)
     return
Esempio n. 21
0
 async def History(self, ctx):
     # Grab the time frame that the user is trying to get their stats from
     reportLength = " ".join(ctx.message.content.split(" ")[1:]).lower()
     # grab their username from the database function
     username = database().searchDefault(ctx.message.author.id,
                                         ctx.message.server.id)
     # create the placeholder for the message that will be sent to the user
     msg = ""
     if username == "":
         await self.bot.say("You must be registered to use this command")
         return
     if reportLength == "":
         msg += "**{}**".format(date.today())
         now = datetime.now()
         day = date.today()
         # Right here below me, this is where the issue is having two different time libraries is a pain in the ass
         # To add to that, I have a kinda bad piece of code here that only serves to find out if it is between midnight and 4am
         if time(0, 00) <= now.time() <= time(4, 00):
             day = (day - dt.timedelta(days=1))
             msg = "**{}**".format(day - dt.timedelta(days=1))
         dataThen = database().getStatsXP(username, day)
     # Week and month are essentially the same thing
     elif reportLength == "week":
         compareDate = (date.today() - dt.timedelta(days=7))
         msg += "**{}**".format(compareDate)
         dataThen = database().getStatsXP(username, compareDate)
     elif reportLength == "month":
         compareDate = (date.today() - dt.timedelta(days=30))
         msg += "**{}**".format(compareDate)
         dataThen = database().getStatsXP(username, compareDate)
     # Will just pull from the first available stats that that person has on file
     elif reportLength == "all":
         dataThen = database().firstStatsXP(username)
         msg += "**{}**".format(dataThen[24])
     else:
         await self.bot.say("Accepted timeframes:\n`week`\n`month`\n`all`")
         return
     dataNow = beautInfo().userStats(username)
     try:
         for x in range(1, 24):
             info = dataNow[x].split(",")
             if int(info[2]) > dataThen[x]:
                 msg += "\n`-" + self.labels[x] + (
                     "." * (20 - len(self.labels[x]))
                 ) + "{:,}".format(int(info[2]) - dataThen[x]) + "`"
     except TypeError:
         await self.bot.say(
             "Your account has not collected enough data to go that far back"
         )
         return
     emb = embeds.Embed(title=username, description=msg, color=0xc27c0e)
     discordName = await self.bot.get_user_info(ctx.message.author.id)
     totXP = "{:,}".format(int(dataNow[0].split(",")[2]) - dataThen[0])
     emb.set_footer(text=(str(discordName) + " (" + totXP + "xp)"),
                    icon_url=ctx.message.author.avatar_url)
     await self.bot.say(embed=emb)
     return
Esempio n. 22
0
def format_last_update(img_link, num_att):
    embed = embeds.Embed(
        title="ATUALIZAÇÃO " + str(num_att),
        colour=Colour.random()
    )

    embed.set_image(url=img_link)

    return embed
 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)
Esempio n. 24
0
    async def ripple(self, ctx):
        request = requests.get(
            "https://bitbay.net/API/Public/XRPEUR/ticker.json").json()["last"]
        embed = embeds.Embed(
            title="Aktueller Ripple Kurs:",
            description=f"Der aktuelle Ripple Kurs beträgt: {request}€.",
            color=0x1acdee)

        embed.set_author(name="Zemo Bot", icon_url=self.bot.icon_url)
        return await ctx.send(embed=embed)
Esempio n. 25
0
    async def time(self, ctx):
        """ Current Eve Time """

        if ctx.invoked_subcommand is None:
            async with ctx.typing():
                await asyncio.sleep(.5)
                return await ctx.send(
                    embed=embeds.Embed(title='Current EVE Time:',
                                       description=pendulum.now(
                                           tz='UTC').to_datetime_string()))
 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)
Esempio n. 27
0
 async def time(self, ctx):
     """
     Get current eve time - !help time for more options
     """
     if ctx.invoked_subcommand is None:
         async with ctx.typing():
             await asyncio.sleep(.5)
             return await ctx.send(embed=embeds.Embed(
                 title='Current Eve Time:',
                 description=pendulum.utcnow().to_datetime_string()))
Esempio n. 28
0
 async def role(self, ctx):
     """
     Show your roles & link to message where you can add/remove roles.
     """
     await asyncio.sleep(0.5)
     member = ctx.message.author
     yr = ", ".join(list(map(lambda x: x.name, member.roles)))
     embed = embeds.Embed()
     embed.description = f"Your roles:\n`{yr}`\nManage roles [here]({role_massage_link})."
     await ctx.reply(embed=embed)
Esempio n. 29
0
 async def searchquest(self, message):
     data = {
         'string': " ".join(message.content.split(' ')[1:]),
         'one': 'quests'
     }
     url = self.apiurl + '/search'
     with aiohttp.ClientSession() as session:
         async with session.get(
                 url,
                 params=data,
                 headers={
                     'User-Agent':
                     'AngelBot ( aiohttp 0.26.1 python 3.5.1 )'
                 }) as response:
             if response.status != 200:
                 print(response.status)
                 print(await response.text())
                 return
             jsd = await response.json()
             if jsd['quests']['total'] == 0:
                 await self.bot.send_message(
                     message.channel,
                     "No results for {0} in quests.".format(" ".join(
                         message.content.split(" ")[1:])))
             elif jsd['quests']['total'] == 1:
                 await self.bot.send_message(
                     message.channel, await
                     self.parsequest(str(jsd['quests']['results'][0]['id'])
                                     ))
             else:
                 out = embeds.Embed(
                     description="Search results for {} in quests.".format(
                         " ".join(message.content.split()[1:])))
                 out.set_thumbnail(url="http://i.imgur.com/zkqe2nw.jpg")
                 msgs = [["", ""], ["", ""], ["", ""]]
                 for idx, item in enumerate(jsd['quests']['results']):
                     if len(msgs[idx % 3][0]) + len("[{}]({})\n".format(
                             item['name'], "http://xivdb.com{}".format(
                                 item['url']))) < 1024:
                         msgs[idx % 3][0] += "[{}]({})\n".format(
                             item['name'],
                             "http://xivdb.com{}".format(item['url']))
                         msgs[idx % 3][1] += "ID: {}\n".format(item['id'])
                 out.add_field(name="\u200b", value=msgs[0][0])
                 out.add_field(name="\u200b", value=msgs[0][1])
                 out.add_field(name="\u200b", value=msgs[1][0])
                 out.add_field(name="\u200b", value=msgs[1][1])
                 out.add_field(name="\u200b", value=msgs[2][0])
                 out.add_field(name="\u200b", value=msgs[2][1])
                 out.set_footer(
                     text=
                     "Some search terms return large result sets. Your results may have been paired down."
                 )
                 print(out.to_dict())
                 await self.bot.send_message(message.channel, embed=out)
Esempio n. 30
0
def reverse_embed(js):
    res = embeds.Embed(
        type="rich",
        description=js['descriptions'][0]
        if len(js['descriptions']) > 0 else "Pas de description",
        title=js['titles'][0] if len(js['titles']) > 0 else "Pas de titre")
    res.set_thumbnail(
        url=js['similar_images'][0] if len(js['similar_images']) > 0 else "")
    res.set_footer(
        text="Cette image me fait penser à : {}".format(js['best_guess']))
    return res