예제 #1
0
            def create_embed(current_clan):
                clan_embed = discord.Embed(
                    title=current_clan['clan_name'].capitalize() + " 📜",
                    description="Clan Information and Stats",
                    color=discord.Color.blue())

                clan_embed.add_field(name="Leader(s) 👑",
                                     value=current_clan['leaders'],
                                     inline=True)
                clan_embed.add_field(name="Creation Date ⏰",
                                     value=current_clan['creation_date'],
                                     inline=True)
                clan_embed.add_field(name="CS Wins 🏆",
                                     value=current_clan['cs_wins'],
                                     inline=False)
                clan_embed.add_field(name="Matches Played 🥊",
                                     value=current_clan['cs_matches'],
                                     inline=True)
                clan_embed.add_field(name="Winrate 📈",
                                     value=current_clan['win_rate'],
                                     inline=False)
                clan_embed.set_image(url=current_clan['clan_image'])
                clan_embed.set_footer(text=embed_footer(),
                                      icon_url=self.bot.get_user(
                                          self.bot.user.id).avatar_url)

                return clan_embed
예제 #2
0
 def create_embed(self):
     settings_embed = discord.Embed(title='Settings',
                                    description='Current Settings',
                                    color=discord.Color.blue())
     settings_embed.add_field(name="Points Per Kill",
                              value=self.settings_dict["KillSetting"])
     for key, value in self.settings_dict.items():
         if not isinstance(key, int):
             continue
         settings_embed.add_field(name=f"Place {key} Score", value=value)
     settings_embed.set_footer(text=embed_footer(),
                               icon_url=self.bot.get_user(
                                   self.bot.user.id).avatar_url)
     return settings_embed
예제 #3
0
 def create_embed(current_settings, guild_name, guild_image):
     settings_embed = discord.Embed(
         title=guild_name.capitalize() + " 📜",
         description="Clan Information and Stats",
         color=discord.Color.blue()
         )
     
     roles = " ".join([guild.get_role(role_id).mention for role_id in current_settings['roles']])
     
     settings_embed.add_field(name="Roles 📜", value=roles, inline=True)
     settings_embed.add_field(name="Channel 📺", value=guild.get_channel(current_settings['channel']).mention, inline=True)
     settings_embed.set_thumbnail(url=guild_image)
     settings_embed.set_footer(text=embed_footer(), icon_url=self.bot.get_user(self.bot.user.id).avatar_url)
     
     return settings_embed 
예제 #4
0
    async def setup(self, ctx):
        scrim_settings = self.read_json()
        author = ctx.message.author
        guild = ctx.guild
        guild_id = str(guild.id)
        channel = self.bot.get_channel(int(scrim_settings[guild_id]["channel"]))

        if guild_id in scrim_settings.keys():
            msg = await ctx.send("What kind of match would you like to set up? React with ⚔ for a player vs player match, or react with 🏰 for a clan match.")

            reaction, user = await reaction_wait_for(self.bot, ctx, ["⚔", "🏰"], msg)
            if reaction == "⚔":
                match_type = "Player"
                match_game, match_players, match_time, match_rounds, match_notify, match_info = await self.setup_match(ctx, match_type)
                
            elif reaction == "🏰":
                match_type = "Clan"
                match_game, match_players, match_time, match_rounds, match_teams, match_info = await self.setup_match(ctx, match_type)
                match_notify = match_teams

            match_embed = discord.Embed(
                title="Scrim",
                description=f"{match_game} match at {match_time}\n\n{match_info}",
                color=discord.Color.blue()
            )
            match_embed.add_field(name="Competitors", value=f"{match_players[0]} vs {match_players[1]}", inline=False)
            match_embed.add_field(name="Rounds", value=match_rounds, inline=False)
            match_embed.set_thumbnail(url=guild.icon_url)
            match_embed.set_footer(text=embed_footer(), icon_url=self.bot.get_user(self.bot.user.id).avatar_url)

            if match_type == "Clan":
                match_embed.add_field(name="Team(s)", value=" ".join([notify.mention for notify in match_notify]), inline=False)

            embed_msg = await ctx.send(embed=match_embed)
            
            await ctx.send(f"{author.mention}, please confirm the scrim details by reacting. On approval, match info will be sent to {channel.mention}.")
            reaction, user = await reaction_wait_for(self.bot, ctx, ["✅", "❌"], embed_msg)

            if reaction == "✅":
                await channel.send(embed=match_embed)
                await channel.send(" ".join([notify.mention for notify in match_notify]))
            else:
                match_embed.color = discord.Color.dark_grey()
                match_embed.title += " (Inactive)"
                await embed_msg.edit(embed=match_embed)
예제 #5
0
    async def results(self, ctx, *args):

        leaderboard = self.bot.get_cog('Calculate').get_sorted_leaderboard()
        if not args:
            leaderboard_num = min(10, len(leaderboard))
        else:
            leaderboard_num = min(int(args[0]), len(leaderboard))

        leaderboard_embed = discord.Embed(
            title=f'Top {leaderboard_num} Leaderboard',
            color=discord.Color.blue())
        for i in range(leaderboard_num):
            leaderboard_embed.add_field(
                name=f"{i + 1}. {leaderboard[i][0]}",
                value=f"Score: **{leaderboard[i][1]}**",
                inline=False)

        leaderboard_embed.set_footer(text=embed_footer(),
                                     icon_url=self.bot.get_user(
                                         self.bot.user.id).avatar_url)

        await ctx.send(embed=leaderboard_embed)
예제 #6
0
 def create_embed(current_player):
     player_embed = discord.Embed(
         title=current_player["player_name"].capitalize(),
         description="Player information and stats",
         color=discord.Color.blue())
     player_embed.add_field(
         name="Clan Affiliation",
         value=
         f'{current_player["clan"].capitalize()} react with 🔎 to view the clan',
         inline=True)
     player_embed.add_field(name="Wins",
                            value=current_player["cs_wins"],
                            inline=False)
     player_embed.add_field(name="Total Matches Played",
                            value=current_player["cs_matches"],
                            inline=True)
     player_embed.add_field(name="Win Rate",
                            value=current_player["win_rate"],
                            inline=False)
     player_embed.set_thumbnail(url=current_player["player_image"])
     player_embed.set_footer(text=embed_footer(),
                             icon_url=self.bot.get_user(
                                 self.bot.user.id).avatar_url)
     return player_embed
예제 #7
0
    async def calc(self, ctx, *args):
        show_equation = "((kill_amount * points_per_kill) + points_for_place)"
        bot_id = 757700872791654500
        total_score = 0

        try:

            if len(args) > 2:
                name = args[0]

                i = 1
                temp_value_list = list()
                value_list = list()

                #Organizing all the args into separate lists

                while True:
                    temp_value_list.append(args[i])
                    i += 1
                    if (i - 1) % 3 == 0:
                        value_list.append(temp_value_list)
                        temp_value_list = list()

                    if i == len(args):
                        break

                calc_embed = discord.Embed(title="Calculation",
                                           description=show_equation,
                                           color=discord.Color.blue())

                for item in value_list:
                    total_tuple = self.total(int(item[1]), int(item[2]))
                    total_score += total_tuple[1]
                    calc_embed.add_field(name=item[0],
                                         value=total_tuple[0],
                                         inline=False)

                calc_embed.add_field(name="Total Score",
                                     value=f'**{total_score}**')

                self.data[name] = total_score
            else:
                kill_input = int(args[0])
                place_input = int(args[1])

                calc_embed = discord.Embed(title="Calculation",
                                           description=show_equation,
                                           color=discord.Color.blue())
                calc_embed.add_field(name='Total',
                                     value=self.total(kill_input, place_input))

            #Adding final imformation to the embed, then sending it
            calc_embed.set_footer(text=embed_footer(),
                                  icon_url=self.bot.get_user(
                                      self.bot.user.id).avatar_url)
            await ctx.send(embed=calc_embed)

        except ValueError:
            await ctx.send(
                "When calling `?calculate`, you must give it at least two parameters: kills and place. A valid call to this command would be `?calculate 10 1`. "
            )
        except KeyError:
            await ctx.send(
                "It appears that you don't have any settings. Please use `?settings update` to create settings. "
            )
예제 #8
0
    async def info(self, ctx):

        cogs = list(self.bot.cogs)

        shep_id = 498331656822849536
        peter_id = 516652903763542017
        message = ctx.message
        emoji_list = ['🤖', '🏠']

        info_embed_home = discord.Embed(
            title="Info",
            description=
            f"Information about the ZCC Bot\nReact with {emoji_list[0]} to see the commands for this bot",
            color=discord.Color.blue())
        info_embed_home.add_field(name="Created",
                                  value="September, 2020",
                                  inline=True)
        info_embed_home.add_field(
            name="Creators",
            value=
            f"{self.bot.get_user(shep_id).mention} & {self.bot.get_user(peter_id).mention}",
            inline=True)
        info_embed_home.set_footer(text=embed_footer(),
                                   icon_url=self.bot.get_user(
                                       self.bot.user.id).avatar_url)

        commands_embed = discord.Embed(
            title="Commands",
            description=
            f"Commands in the ZCC Bot\nReact with {emoji_list[1]} to see info about the ZCC Bot",
            color=discord.Color.blue())

        for name in cogs:
            cog = self.bot.get_cog(name)

            for c in cog.get_commands():
                if isinstance(c, commands.Group):
                    command_string = ""
                    for sub_c in c.walk_commands():
                        command_string += "〰" + sub_c.help.replace(
                            "{prefix}", self.prefix) + "\n" * 2

                    commands_embed.add_field(
                        name=f"**{self.prefix}{c.name}**",
                        value=f"**Subcommands**\n{command_string}",
                        inline=False)
                else:
                    commands_embed.add_field(
                        name=f"**{self.prefix}{c.name}**",
                        value="〰" + c.help.replace('{prefix}', self.prefix),
                        inline=False)

        embed_message = await ctx.send(embed=info_embed_home)

        commands_embed.set_footer(text=embed_footer(),
                                  icon_url=self.bot.get_user(
                                      self.bot.user.id).avatar_url)
        for emoji in emoji_list:
            await embed_message.add_reaction(emoji)

        def check(reaction, user):
            return user == message.author and str(reaction.emoji) in emoji_list

        i = 0
        j = 0
        while True:
            try:
                reaction, user = await self.bot.wait_for('reaction_add',
                                                         timeout=20.0,
                                                         check=check)

                if str(reaction) == emoji_list[0]:
                    i += 1  #using this to check which embed i'm on
                    await embed_message.edit(embed=commands_embed)
                elif str(reaction) == emoji_list[1]:
                    j += 1
                    await embed_message.edit(embed=info_embed_home)
            except asyncio.TimeoutError:
                if i > j:
                    commands_embed.color = discord.Color.dark_grey()
                    commands_embed.description = 'Inactive'
                    await embed_message.edit(embed=commands_embed)
                    break
                else:  #assuming that j > i
                    info_embed_home.color = discord.Color.dark_grey()
                    info_embed_home.description = 'Inactive'
                    await embed_message.edit(embed=info_embed_home)
                    break