Пример #1
0
    def help_command(self, event, name: str = None):  # TODO: Fix issue with commands with same name different group
        """
        ***The Help Command***

        This command will provide information on a certain command, or list all commands if no command is specified.

        ***Optional Values***
        > __name__ **The name of the target command**
        """
        if name is None:
            collections = [plugin.command_list for plugin in self.bot.plugins.values()]
            complete = []
            for collection in collections:
                complete.extend(collection)

            embed = MessageEmbed()
            embed.title = 'List of Commands'
            embed.color = 0x6832E3
            embed.description = ', '.join(complete)
        else:
            for plugin in self.bot.plugins.values():
                desc = plugin.get_help(name.lower())
                if desc:
                    break
            else:
                return event.msg.reply("Could not find command '{}'".format(S(name)))
            embed = MessageEmbed()
            embed.title = '**{}**'.format(name)
            embed.color = 0x6832E3
            embed.description = desc

        event.msg.reply(" ", embed=embed)
Пример #2
0
    def on_profile_command(self, event, args):
        """Displays your profile for the world to see!"""
        mariadb = self.bot.plugins.get("mariadb_funcs")
        if args.userID:
            user = args.userID
            user = re.sub("[<@!>]", '', user)
        else:
            user = event.msg.author.id
        if mariadb.check_user_exists(user):
            usrSettings = mariadb.get_user_settings(user)
            userID = usrSettings[0]
            userObj = self.state.users.get(userID)
            userPFPLink = userObj.get_avatar_url()
            userGoBy = usrSettings[1]
            userDesc = usrSettings[2]
            userTimezone = usrSettings[3]
            userIntFacts = usrSettings[4]

            if userObj.presence is not UNSET:
                usrState = userObj.presence.status
            else:
                usrState = "offline"

            profileEmbed = MessageEmbed()
            profileEmbed.title = "The amazing profile of {0}#{1} who is currently **{2}**!".format(
                userObj.username, userObj.discriminator, usrState)
            profileEmbed.set_thumbnail(url=userPFPLink)

            color = random.randint(0, 0xFFFFFF)
            profileEmbed.color = color

            if userDesc == None:
                profileEmbed.description = """This user hasn't set a description!
                Please run `@Who Am I#1225 adjustprofile blurb`"""
            else:
                profileEmbed.description = userDesc

            if userGoBy != None:
                profileEmbed.add_field(name="Howdy! Call me...",
                                       value="```{}```".format(userGoBy),
                                       inline=True)

            if userTimezone != None:
                profileEmbed.add_field(name="My timezone is...",
                                       value="```{}```".format(userTimezone),
                                       inline=True)

            if userIntFacts != None:
                profileEmbed.add_field(
                    name="Here is an interesting fact about me!",
                    value="```{}```".format(userIntFacts),
                    inline=True)

            event.msg.reply(embed=profileEmbed)

        else:
            event.msg.reply(
                ":no_good: This user does not have a profile!",
                "They can make one by running `@Who Am I#1225 setup`")
Пример #3
0
    def about_command(self, event):
        """Gets some basic info about the bot"""
        embed = MessageEmbed()
        embed.set_author(name='Referee', icon_url=self.client.state.me.avatar_url, url='https://github.com/UHCBot/Referee')
        embed.description = self.BOT_DESC
        embed.add_field(name='Uptime', value=humanize.naturaldelta(datetime.utcnow() - STARTED), inline=True)
        embed.description = self.BOT_DESC
        embed.color = 0xf3733a

        event.msg.reply(embed=embed)
Пример #4
0
    def show_help(self, event, name: str = None):
        """Explain commands or list them

        The help commands provides an easy way for you to learn about a certain command, or list available ones.

        If you want to access a specific command, type `]help <name>`, For example, `]help ban`.

        If you want to display a list all command categories, simply type `]help` with nothing else.

        If you want to list all commands in a category, simply type `]help <Name>`, For example, `]help Mod`

        Tip: commands will always be all lower case, command categories are Titled.
        """

        if not name:
            embed = MessageEmbed()
            embed.color = 0x00FFFF
            embed.title = "List Command Categories"
            embed.description = "If you want to see how to use the help command, type `]help help`, otherwise, " \
                                "below are the available command categories."
            for plugin in self.bot.plugins.values():
                name, desc = plugin.__doc__.split(' | ')
                embed.add_field(name=name, value=desc, inline=False)
            event.msg.reply(embed=embed)
        elif name.title() == name:
            for plugin in self.bot.plugins.values():
                if name in plugin.__doc__:
                    break
            else:
                return event.msg.reply(
                    "Sorry, but I could not find the category '{0}'".format(
                        name))

            embed = MessageEmbed()
            embed.color = 0x00FFFF
            embed.title = plugin.__doc__

            for func in plugin.meta_funcs:
                if hasattr(func, 'docs'):
                    embed.add_field(name=func.docs[0],
                                    value=func.docs[1],
                                    inline=False)

            event.msg.reply(embed=embed)
        else:
            for plugin in self.bot.plugins.values():
                for func in plugin.meta_funcs:
                    if hasattr(func, 'docs') and func.docs[0] == name:
                        embed = MessageEmbed()
                        embed.title = func.docs[1]
                        embed.color = 0x00FFFF
                        embed.description = func.docs[2]
                        return event.msg.reply(embed=embed)
            event.msg.reply(
                "Sorry, but I could not find the command '{0}'".format(name))
Пример #5
0
    def help(self, event):
        embed = MessageEmbed()
        embed.title = "Bepis Boi's commands"
        embed.description = """Here are my commands:\n
***Shibe Commands***
**catch** | Find a random shibe, and add it to your inventory.
**inv** [#] | Look at your collection of shibes, always stored in stacks.
**show** <ID> | Show off your shibes, how cute they are.
**trade** <@> <ID> | Move your shibe into anther person's inventory.
**release** <ID> | Send your shibe off, into the wild.
**redeem** <ABC> | Redeem a code, and earn a shibe created from our great shibe admins.

***Shop Commands***
**bepis** [@] | Admire your bepis, or make fun of someone else's.
**sell** <ID> | Sell one of your shibes. Don't worry, they're in good hands.
**shop** [#] | Look at our large inventory of shibes, you know you want too.
**buy *shibe*** <ID> | Buy a shibe from our shop. It's worth every bepis.
**donate** <@> <#> | Feeling charitable? Donate bepis to someone else.
**flip** <#> | Flip a coin. You win, double your bet. Lose, lose your bet.
**ticket** <#> | Buy a certain amount of tickets, the more the merrier."""
        embed.set_footer(text="<>: required, []: optional, @: mention, "
                              "#: number, ID: shop ID / inventory ID, ABC: text")
        embed.color = 0x000080
        event.msg.reply(embed=embed)

        embed = MessageEmbed()
        embed.title = "Bepis Boi's commands"

        embed.description = """Here are my commands:\n
***Fun Commands***
*The following commands don't take any arguments, and show images / videos.*
**disrespect, tarnation, anthem, drincc, pat, politics, soviet, stop,
approved, extreme, no, blank, shibe, gethapp.**

***Extra Commands***
**invite** | Create an invite link, and share it with your friends to earn bepis.
**battle** <@> <ID> | Challenge someone to a duel, pick shibes, winner get's the loser's shibe.
**ping** | Pong.
**help** | You're looking at it.
**role** <ABC> | Add a sweet role to your account, so people know they're not alone.
**unrole** <ABC> | Remove a previously added role from your account, yw.
**source** | I had to prove the battle cmd wasn't rigged some how.

***Shibe Manager***
*The following commands require the Shibe Manager role*
**set *shibe*** <@> <#> <ABC> | Set a certain amount of a shibe to someone.
**set *bepis*** <@> <#> | Ste a certain amount of bepis to someone.
**reload** <catch/shrine> | When a new image is added, reload the bot's img cache.
**gencode** <ABC> | Create a code that can be redeemed, for whatever shibe is supplied.
"""
        embed.set_footer(text="<>: required, []: optional, @: mention, "
                              "#: number, ID: shop ID / inventory ID, ABC: text")
        embed.color = 0x000080
        event.msg.reply(embed=embed)
Пример #6
0
 def log_action(self, action: str, content: str, target=None, **kwargs):
     embed = MessageEmbed()
     embed.title = action + ("  | " +
                             str(target.user)) if target is not None else ""
     embed.color = 0x6832E3
     if target is not None:
         embed.description = content.format(t=target.user, **kwargs)
         embed.set_thumbnail(url=target.user.avatar_url)
     else:
         embed.description = content.format(**kwargs)
     embed.timestamp = datetime.utcnow().isoformat()
     self.client.api.channels_messages_create(
         self.config["BOT_LOGGING_CHANNEL"], " ", embed=embed)
Пример #7
0
 def cmd_help(self, event, command=None):
     """
     This is the help command! Use this command to help you get info some certain commands.
     Usage: `help [Command Name]`
     To get general info, just type `help`
     """
     if command is None:
         embed = MessageEmbed()
         embed.title = 'GamesKeeper Help'
         embed.description = '**To get help with a certain command please use `{prefix}help Command`**\n** **\nFor help with settings please type `{prefix}help settings`'.format(
             prefix=event.db_guild.prefix)
         return event.msg.reply('', embed=embed)
     elif command == 'settings' and (event.user_level == 100
                                     or event.bot_admin):
         embed = MessageEmbed()
         embed.title = 'GamesKeeper Settings Help'
         description = [
             'To change most settings, the command group is `update`',
             '\♦ To change **Prefix**, use `{}settings prefix`'.format(
                 event.db_guild.prefix),
             '\♦ To change **Games Category**, use `{}settings gc`'.format(
                 event.db_guild.prefix),
             '\♦ To change the **Referee** role, use `{}settings ref`'.
             format(event.db_guild.prefix),
             '\♦ To update **Spectator** roles, use `{}settings addspec/rvmspec`'
             .format(event.db_guild.prefix),
             '\♦ To **Enable/Disable Games**, use `{}games enable/disable`'.
             format(event.db_guild.prefix),
         ]
         embed.description = '\n'.join(description)
         return event.msg.reply('', embed=embed)
     elif command == 'settings' and (event.user_level != 100
                                     or not event.bot_admin):
         return event.msg.reply('`Error:` Command Not Found')
     else:
         commands = list(self.bot.commands)
         for cmd in commands:
             if cmd.name != command:
                 continue
             elif cmd.level == -1 and not event.bot_admin:
                 continue
             else:
                 embed = MessageEmbed()
                 embed.title = 'Command: {}{}'.format(
                     '{} '.format(cmd.group) if hasattr(cmd, 'group')
                     and cmd.group is not None else '', cmd.name)
                 helpstr = cmd.get_docstring()
                 embed.description = helpstr
                 return event.msg.reply('', embed=embed)
         return event.msg.reply('`Error:` Command Not Found')
Пример #8
0
    def render_status_command(self):
        param = {
            "orderBy": "time desc",
            "recordsPerPage": 1,
            "page": 0
        }

        res = requests.get(BACKEND_HOST + '/document/vendors-update', params=param, headers={SESSION_HEADER: self.session}).json()
        info = res['data'][0]
        
        today = arrow.utcnow()
        reset_text = ""

        if today.weekday() == 5:
            reset_text = "in 6 days"
        else:
            temp = today.shift(weekday=5)
            reset_text = temp.humanize()
        
        last_updated = arrow.Arrow.fromtimestamp(info['time'])

        embed = MessageEmbed()
        embed.title = "Last Updated %s" % last_updated.humanize()
        embed.description = "by %s" % info['updater']
        
        embed.add_field(name='Next Vendor Reset (in game)', value=reset_text, inline=True)

        return embed
Пример #9
0
    def render_vendor_gear(self, gear):
        embed = MessageEmbed()

        embed.title = gear['name']
        embed.description = gear['vendor']

        embed.add_field(name='Price', value=gear['price'], inline=True)
        embed.add_field(name='Armor', value=gear['armor'], inline=True)
        embed.add_field(name="Gearscore", value=gear['score'], inline=True)

        if (gear['fire'].strip().strip('-')):
            embed.add_field(name='Firearms', value=gear['fire'], inline=True)
        if (gear['stam'].strip().strip('-')):
            embed.add_field(name='Stamina', value=gear['stam'], inline=True)
        if (gear['elec'].strip().strip('-')):
            embed.add_field(name='Electronics', value=gear['elec'], inline=True)
        
        major_attr = "  **|**  ".join(gear["major"].strip().strip("-").split("<br/>"))
        minor_attr = "  **|**  ".join(gear["minor"].strip().strip("-").split("<br/>"))

        if major_attr:
            embed.add_field(name='Major Attribute(s)', value=major_attr, inline=True)
        
        if minor_attr:
            embed.add_field(name='Minor Attribute(s)', value=minor_attr, inline=True)
        
        if gear['rarity'] == 'header-he':
            embed.color = 0xDA9513
        else:
            embed.color = 0x07C973
        
        return embed
Пример #10
0
    def create_poll(self, event, question: str):
        responses = {}
        for letter in self.LETTERS:
            event.msg.reply(
                "Response {}: Send 'exit' to post, 'cancel' to cancel the poll"
                .format(letter))
            msg = self.get_msg(event)
            if msg is None:
                return
            if msg.content == 'exit':
                break
            if msg.content == 'cancel':
                return
            responses[letter] = msg.content

        if self.poll_msg:
            self.reset_channel()

        embed = MessageEmbed()
        embed.title = "New poll question!"
        embed.color = 0x6832E3
        embed.timestamp = datetime.utcnow().isoformat()
        embed.description = "\n".join(
            [question + "\n"] +
            [l + " **" + q + "**" for l, q in responses.items()])
        self.sub_role.update(mentionable=True)
        sleep(.5)
        poll_msg = self.poll_channel.send_message(self.sub_role.mention,
                                                  embed=embed)
        self.sub_role.update(mentionable=False)
        self.poll_msg = poll_msg
        self.poll_msg.pin()
        for emoji in responses:
            sleep(.5)
            self.poll_msg.add_reaction(emoji)
Пример #11
0
    def on_setup_commmand(self, event):
        """Create and set all your profile options in one easy prompt!"""
        PrefixHandler = self.bot.plugins.get("PrefixHandler")
        promptSetup = MessageEmbed()
        promptSetup.title = "Make your profile!"
        promptSetup.description = """Welcome to the setup prompt for the Who Am I bot!\n
         This will lead you through the essential setup of your profile!\n
         Please say `yes` if you are ready to continue, or `no` if you changed your mind.
         Say **cancel** on any prompt to skip that prompt."""
        promptSetup.color = 0x8DD0E1

        event.msg.reply(embed=promptSetup)
        confirmation = PrefixHandler.prompt_for_arg(event,
                                                    timeLimit=15,
                                                    choices=("`yes` or `no`"))

        if confirmation == "yes":
            event.msg.reply("Starting setup now...")
            gevent.sleep(3)
            self.on_callme_setting(event)
            self.on_blurb_setting(event)
            self.on_timezone_setting(event)
            self.on_facts_setting(event)
            event.msg.reply(
                "Setup complete, your profile has been made/updated!")
        elif confirmation == "no":
            event.msg.reply("**Setup cancelled.**")
        else:
            event.msg.reply(
                "That wasn't an option... Prompt cancelled, try again.")
Пример #12
0
    def command_test(self, event):
        embed = MessageEmbed()

        #sets the title of the embed
        embed.title = 'Game Center Central'
        embed.set_author(
            name='Game Center Central',
            url='https://discord.ares.party',
            icon_url='https://blog.ares.party/content/images/2018/01/pfp.gif')
        embed.description = 'A server built on on the topics of games and other things.'
        #Inline field 1
        embed.add_field(name='Why is our server different',
                        value='Well, Its different in many ways.')
        #Inline field 2
        embed.add_field(name='What does ares break?', value='Everything.')
        #Inline field 3
        embed.add_field(name='Can I break things with Ares',
                        value='Pls no, We dont need more shit broken kthx.')
        #timestap
        embed.timestamp = datetime.utcnow().isoformat()
        #footer
        embed.set_footer(text='This is the f*****g footer you dumb ass.')
        #color
        embed.color = randint(0, 16777215)
        event.msg.reply(embed=embed)
Пример #13
0
    def check_quota(self, event, quota_name):
        base = self.bot.plugins["BasePlugin"]
        moderators = base.get_staff_in_quota(quota_name, MessagesParticipant)
        if moderators is None:
            event.msg.reply(":no_entry_sign: unknown quota.")
            return
        quota_fail_list = []
        quota_fail_embed = MessageEmbed()
        for moderator in moderators:
            if not moderator.eligible:
                quota_fail_list.append("{count} - <@{id}>".format(
                    id=moderator.user_id, count=moderator.message_count))
        if len("\n\n".join(quota_fail_list)) > 2047:
            for moderator in moderators:
                if not moderator.eligible:
                    quota_fail_embed.add_field(
                        value="<@{id}>".format(id=moderator.user_id),
                        name="Message count: {count}".format(
                            count=moderator.message_count))
        if len(quota_fail_embed.fields) == 0 and len(quota_fail_list) == 0:
            quota_fail_embed.title = "{green_emoji} All staff passed the quota!".format(
                green_emoji=self.config.green_tick_emote)
            quota_fail_embed.color = 0x38ff48
        else:
            if len(quota_fail_embed.fields) == 0:
                quota_fail_list.sort(key=quotaSort)
                quota_fail_embed.description = "\n\n".join(quota_fail_list)
                fail = len(quota_fail_list)
            else:
                fail = len(quota_fail_embed.fields)
            quota_fail_embed.title = "{red_emoji} {fail} staff failed the quota!".format(
                red_emoji=self.config.red_tick_emote, fail=fail)
            quota_fail_embed.color = 0xff451c

        event.msg.reply("Quota check:", embed=quota_fail_embed)
Пример #14
0
    def on_commands_info(self, event, mid):
        cmd = Command.select(Command, Message, Channel).join(
            Message,
            on=(Command.message_id == Message.id).alias('message')).join(
                Channel,
                on=(Channel.channel_id == Message.channel_id).alias('channel')
            ).join(
                User,
                on=(User.user_id == Message.author_id).alias('author')).where(
                    Command.message_id == mid).order_by(
                        Message.timestamp.desc(), ).get()

        embed = MessageEmbed()
        embed.title = '{}.{} ({})'.format(cmd.plugin, cmd.command,
                                          cmd.message.id)
        embed.set_author(name=str(cmd.message.author),
                         icon_url=cmd.message.author.get_avatar_url())
        embed.color = 0x77dd77 if cmd.success else 0xff6961

        if not cmd.success:
            embed.description = '```{}```'.format(cmd.traceback)

        embed.add_field(name='Message', value=cmd.message.content)
        embed.add_field(name='Channel',
                        value='{} `{}`'.format(cmd.message.channel.name,
                                               cmd.message.channel.channel_id))
        embed.add_field(name='Guild', value=str(cmd.message.guild_id))
        event.msg.reply(embed=embed)
Пример #15
0
    def store(self, event):
        if event.guild is not None:
            event.msg.delete()

        embed = MessageEmbed()
        embed.title = "Discord Testers Shop"
        embed.description = "Use XP to get super cool Dabbit-approved rewards from the shop!"
        embed.thumbnail.url = "https://cdn.discordapp.com/attachments/330341170720800768/471497246328881153/2Mjvv7E.png"
        embed.color = int(0xe74c3c)  # bug hunter red = #e74c3c

        index = 0
        for item in self.config.store:
            index = index + 1
            name = item["title"]
            content = "Cost: {cost}\nDescription: {description}\n{link}Buy this with `+buy {id}`".format(
                cost=item["cost"],
                description=item["description"],
                link="" if item.get("link", None) is None else "[Example]({link})\n".format(link=item["link"]),
                id=index
            )

            embed.add_field(name=name, value=content, inline=False)
        try:
            channel = event.msg.author.open_dm()
            channel.send_message("Shop:", embed=embed)
        except:
            event.channel.send_message("please open your direct messages.").after(10).delete()
Пример #16
0
    def on_commands(self, event, args):
        embed = MessageEmbed()
        embed.color = cfg.color

        if len(args.category) > 0:
            for cat in self.cmds:
                if args.category.lower() in cat.lower():
                    embed.title = cat

                    for k in self.cmds[cat]:
                        embed.add_field(name="`{}`".format(
                            self.cmds[cat][k][0]),
                                        value=self.cmds[cat][k][1],
                                        inline=False)
                    event.msg.reply('', embed=embed)
                    return

            event.msg.reply("Category not found")
            return

        embed.title = "Commands"
        embed.description = "`!help` show this message\n`!help <category>` show more info for category"

        for cat in self.cmds:
            embed.add_field(name=cat,
                            value="`{}`".format(' '.join(
                                x for x in self.cmds[cat])),
                            inline=False)
        event.msg.reply('', embed=embed)
Пример #17
0
    def plugin_manager(self, event, plugin=None, mode='list'):
        if mode == 'list':
            embed = MessageEmbed()
            embed.color = 0x7289da
            embed.set_author(name='Loaded Plugins ({})'.format(len(self.bot.plugins)), icon_url=self.state.me.avatar_url)
            embed.description = '```md\n{}```'.format('\n'.join('- {}'.format(key) for key in self.bot.plugins))
            embed.set_footer(text='Use file name for load, registered name for unload/reload.')
            return event.msg.reply('', embed=embed)

        pl = self.bot.plugins.get(plugin)

        if mode == 'load':
            if pl:
                return event.msg.reply('<:{}> {} plugin is already loaded.'.format(RED_TICK_EMOJI, pl.name))
            try:
                self.bot.add_plugin_module('rowboat.plugins.{}'.format(plugin))
            except:
                return event.msg.reply('<:{}> Failed to load {} plugin.'.format(RED_TICK_EMOJI, plugin))
            return event.msg.reply(':ok_hand: Loaded {} plugin.'.format(plugin))

        if not pl:
            return event.msg.reply('<:{}> Could not find this plugin.'.format(plugin))

        if mode == 'unload':
            self.bot.rmv_plugin(pl.__class__)
            self.log.info('Unloaded {} plugin'.format(pl.name))
            return event.msg.reply(':ok_hand: Unloaded {} plugin.'.format(pl.name))

        if mode == 'reload':
            self.bot.reload_plugin(pl.__class__)
            self.log.info('Reloaded {} plugin'.format(pl.name))
            return event.msg.reply(':ok_hand: Reloaded {} plugin.'.format(pl.name))
Пример #18
0
    def print_needs(self, event, roles, name):
        songs = self.pad_reader.get_inst_songs(self.pad_reader.getpads(),
                                               roles)

        if not songs:
            event.msg.reply("Hmm, doesn't seem to be anything...")
        else:
            embed = MessageEmbed()
            embed.title = "In need of " + name
            embed.color = cfg.color
            embed.description = ""
            for k, v in songs:
                embed.description = embed.description + "({}) [{}]({}) `{}`\n".format(
                    str(len(k.needs)), k.title, k.url, ", ".join(v))

            paginator.create(self, embed, event.msg.reply)
Пример #19
0
    def on_urban(self, event, phrase=None):
        self.client.api.channels_typing(event.msg.channel_id)

        urban_entry = None

        if phrase is None:
            urban_entry = random.choice(
                ud.random())  # grab some random words | list of urbandef
        else:
            defs = ud.define(phrase)

            if len(defs) > 0:
                urban_entry = defs[0]

        if urban_entry is None:
            event.msg.reply('Failed to find a definition for that!')
        else:
            definition = urban_entry.definition
            # Let's do a little... checking!
            if len(definition) >= 2000:
                definition = definition[:1950] + '...'

            # Let's construct an embed :)
            embed = MessageEmbed()
            embed.title = f"**Defintion of {urban_entry.word}**"
            embed.description = definition

            embed.add_field(name='Example', value=urban_entry.example)
            embed.add_field(
                name='Rating',
                value=f"{urban_entry.upvotes} 👍 | {urban_entry.downvotes} 👎")

            embed.color = '5824574'

            event.msg.reply(embed=embed)
Пример #20
0
 def generate_store_embed(self, current, max):
     embed = MessageEmbed()
     embed.title = "Discord Testers Store ({current}/{max})".format(current=str(current + 1), max=str(max + 1))
     embed.description = "Use XP to get super cool Dabbit-approved:tm: rewards from the store!"
     embed.thumbnail.url = "https://cdn.discordapp.com/attachments/330341170720800768/471497246328881153/2Mjvv7E.png"
     embed.color = int(0xe74c3c)
     return embed
Пример #21
0
    def on_generate(self, event, query):
        res = self.wolfram.query(query)
        if res.success.lower() == "true":
            results = list(res.results)
            pods = list(res.pods)

            if results:
                answer = results[0]
                if answer.title == "Distribution of total" and "@scanner" in answer and answer.scanner == "Dice":
                    for pod in pods:
                        if pod.title == "Example":
                            answer = pod
                            break
            elif len(pods) > 1:
                answer = pods[1]
            else:
                event.msg.reply("no results")
                return

            if "@scanner" in answer and answer.scanner == "Dice":
                embed = MessageEmbed()
                embed.color = cfg.color
                embed.description = answer.text
                embed.set_image(url=answer["subpod"]["img"]["@src"])
                event.msg.reply("", embed=embed)
            elif answer.text:
                event.msg.reply(answer.text)
            else:
                embed = MessageEmbed()
                embed.color = cfg.color
                embed.set_image(url=answer["subpod"]["img"]["@src"])
                event.msg.reply("", embed=embed)

        else:
            event.msg.reply("no results")
Пример #22
0
 def gen_participants_embed(page, num, max):
     embed = MessageEmbed()
     embed.title = "Event participants {}/{}".format(num, max)
     embed.description = page
     embed.timestamp = datetime.utcnow().isoformat()
     embed.color = int('F1C40F', 16)
     return embed
Пример #23
0
 def get_xp_cooldown(self, event):
     cd_limit = time.time() - 86400
     em = MessageEmbed()
     em.title = 'Queue XP actions'
     em.description = 'Your queue actions gaining XP (past 24 hours):'
     em.color = '7506394'
     for action, limit in self.config.reward_limits.items():
         action_name = self.config.cooldown_map.get(action, None)
         if action_name is None:
             continue
         user_actions = self.actions.find({
             'user_id': str(event.author.id),
             'type': action,
             'time': {
                 '$gte': cd_limit
             }
         }).limit(limit)
         recent = [x['time'] for x in user_actions]
         used = len(recent)
         fv = f'{used}/{limit}'
         if used >= limit:
             rem_secs = (min(recent) + 86400) - time.time()
             hours, rem = divmod(rem_secs, 3600)
             mins, secs = divmod(rem, 60)
             fv += f' - Cools down in {int(hours)}h {int(mins)}m {int(secs)}s'
         em.add_field(name=action_name, value=fv)
     event.msg.reply(embed=em)
Пример #24
0
def get_queue_embed_item(entry, count):
    description = entry.description
    if not description:
        description = "_None_"
    category_breadcrumbs = "#" + entry.category_channel_name
    if entry.genre_category_name:
        category_breadcrumbs = "#" + entry.genre_category_name + " / " + category_breadcrumbs

    embed = MessageEmbed()
    embed.title = "Items in queue: {numberOfItems}".format(numberOfItems=count)
    if entry.state == 4:
        embed.description = '🔄 Category Change!'
    embed.add_field(name='Name', value=entry.name, inline=True)
    embed.add_field(name='Description', value=description, inline=True)
    embed.add_field(name='Category', value=category_breadcrumbs, inline=True)
    embed.add_field(name='Invite',
                    value="discord.gg/{entry.invite_code}".format(entry=entry),
                    inline=True)
    embed.add_field(name='Server ID',
                    value="`#{entry.server_id}`".format(entry=entry),
                    inline=True)
    embed.add_field(
        name='Invitee',
        value="<@{entry.invitee_id}>\n`#{entry.invitee_id}`".format(
            entry=entry),
        inline=True)
    embed.add_field(name='Submitted At',
                    value="{entry.submitted_at}".format(entry=entry),
                    inline=True)
    embed.set_footer(text="ID: {entry.id}".format(entry=entry))
    # embed.color = 0xffd700
    return embed
Пример #25
0
    def message_updated(self, msg):
        # ignore bot messages
        if not bool(msg.author.id):
            return
        if msg.guild is not None:
            try:
                logchannel = self.logger[msg.guild.id]
                msg_old = self.logger.getHistory(
                    msg.guild.id, msg.channel.id).getContent(msg.id)
                self.logger.updateMessage(msg)

                embed = MessageEmbed()
                embed.title = 'Message updated in: **#{}**'.format(
                    msg.channel.name)
                embed.description = '**{}**\n***old:***\n{}\n***new:***\n{}'.format(
                    msg.author.username.encode("ascii", "ignore"), msg_old,
                    msg.content)
                embed.color = int("1388D6", 16)
                #embed.set_author(name = '{}:'.format(msg.author.username))
                #embed.add_field(name = 'old:', value = msg_old)
                #embed.add_field(name = 'new:', value = msg.content)

                msg.guild.channels[logchannel].send_message('', embed=embed)
            except KeyError:
                pass
Пример #26
0
    def message_delete(self, event):
        channel = self.state.channels[event.channel_id]
        server = channel.guild
        # ignore bot messages
        #if not bool(msg.author.id):
        #	return
        if server is not None:
            logchannel = self.logger[server.id]
            try:
                message = self.logger.getHistory(server.id,
                                                 channel.id)[event.id]
                # ingore embed only messages
                if not bool(message.content):
                    return

                embed = MessageEmbed()
                embed.title = "Message deleted in: **#{}**".format(
                    channel.name)
                embed.description = '**{}**\n{}'.format(
                    message.author.username.encode("ascii", "ignore"),
                    message.content)
                embed.color = int("D3262E", 16)
                #embed.type = 'fields'
                #embed.add_field(name = message.author.username, value = message.content)
                server.channels[logchannel].send_message('', embed=embed)

            except KeyError:
                pass
Пример #27
0
 def command_about(self, event):
     embed = MessageEmbed()
     embed.set_author(name='Rowboat', icon_url=self.client.state.me.avatar_url, url='https://docs.rowboat.party/')
     embed.description = BOT_INFO
     embed.add_field(name='Servers', value=str(Guild.select().count()), inline=True)
     embed.add_field(name='Uptime', value=humanize.naturaltime(datetime.utcnow() - self.startup), inline=True)
     event.msg.reply('', embed=embed)
Пример #28
0
    def prompt_for_arg(self, event, timeLimit, choices=None, fieldName=None):
        if choices:
            argsEmbed = MessageEmbed()
            argsEmbed.title = "Choices, choices..."
            argsEmbed.description = "**Please response with one of these options!**\n\n{}".format(
                choices)
            argsEmbed.set_footer(
                text="This prompt will self-cancel in {} seconds".format(
                    timeLimit))
            argsEmbed.color = 0x8DD0E1
            botprompt = event.msg.reply(embed=argsEmbed)
        else:
            promptEmbed = MessageEmbed()
            promptEmbed.title = "Please input now what you want your **{}** to be!".format(
                fieldName)
            promptEmbed.description = "Or say **`cancel`** if you changed your mind.",
            "(It will just cancel this option)"
            promptEmbed.color = 0x8DD0E1
            promptEmbed.set_footer(
                text="This prompt will self-cancel in {} seconds".format(
                    timeLimit))
            botprompt = event.msg.reply(embed=promptEmbed)

        try:
            with gevent.Timeout(timeLimit, TimeoutError):
                response = self.get_user_response(event)
                Chainable.chain(botprompt, response)
        except TimeoutError:
            event.msg.reply(
                "Timeout limit of `{0} seconds` reached, prompt cancelled.".
                format(timeLimit))
            return "timeout"

        if choices:
            if response.lower() in choices:
                return response.lower()
            else:
                event.msg.reply(
                    "That option was invalid, please choose a correct value!")
                return None
        else:
            lowerResponse = response.strip()
            if lowerResponse.lower() == "cancel":
                event.msg.reply("**Prompt cancelled.**")
                return "cancel"
            else:
                return response
Пример #29
0
 def dis_cmd_help(self, command, command_event, event, guild_obj):
     embed = MessageEmbed()
     embed.title = 'Command: {}{}'.format(
         '{} '.format(command.group) if hasattr(command, 'group')
         and command.group != None else '', command.name)
     helpstr = command.get_docstring()
     embed.description = helpstr
     event.message.channel.send_message('', embed=embed)
Пример #30
0
    def render_exotic_gear(self, exotic_gear):
        embed = MessageEmbed()

        embed.title = exotic_gear['name']
        embed.description = exotic_gear['description']

        embed.color = 0xCF5A2E
        return embed