예제 #1
0
    def Proficiencies(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/proficiencies/{}'.format(name))
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(
                title='Proficiencies Information - {}'.format(value['name']),
                colour=discord.Colour.red())
            # value['starting_proficiencies']
            embed.add_field(name='Name', value=value['name'], inline=False)
            embed.add_field(name='Type', value=value['type'], inline=False)
            embed.add_field(name='Classes - $Class {value}',
                            value=ProficienciesHandler.classHandler(
                                value['classes']),
                            inline=False)
            embed.add_field(name='Races - $Race {value}',
                            value=TraitHandler.raceHandler(value['races']),
                            inline=False)

            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')

        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #2
0
    def ClassEquip(name):
        name = CommsManager.paramHandler(name)

        value = requests.get(
            'https://www.dnd5eapi.co/api/classes/{}/starting-equipment/'.
            format(name))
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(
                title='Class Starting Equipment - {}'.format(name),
                colour=discord.Colour.red())
            embed.add_field(name='Starting Equipment - $Equip {value}',
                            value=start_equip.startEquipmentHandler(
                                value['starting_equipment']),
                            inline=False)
            embed.add_field(name='Starting Equipment Options - $Equip {value}',
                            value=start_equip.equipmentHandler(
                                value['starting_equipment_options']),
                            inline=False)
        else:
            embed = CommsManager.failedRequest(name)
        embed.timestamp = datetime.utcnow()
        embed.set_footer(text='MattMaster Bots: Dnd')

        return embed
예제 #3
0
    def ClassSpell(name):
        name = CommsManager.paramHandler(name)

        value = requests.get(
            'https://www.dnd5eapi.co/api/classes/{}/spells/'.format(name))
        value = eval(value.text)
        counter = math.ceil(
            len(RaceHandler.proficienciesHandler(value['results'])) / 1024)
        counter2 = 0
        if ('error' not in value):
            embed = discord.Embed(
                title='Class Spell Information - {}'.format(name),
                colour=discord.Colour.red())
            while (counter > counter2):
                if (counter2 == 0):
                    temp = counter2 + 1
                    embed.add_field(name='Spells - $Spell {value}',
                                    value=RaceHandler.proficienciesHandler(
                                        value['results'])[counter2 *
                                                          1000:temp * 1000],
                                    inline=False)
                else:
                    temp = counter2 + 1
                    embed.add_field(name='Cont...',
                                    value=RaceHandler.proficienciesHandler(
                                        value['results'])[counter2 *
                                                          1000:temp * 1000],
                                    inline=False)
                counter2 = counter2 + 1
        else:
            embed = CommsManager.failedRequest(name)
        embed.timestamp = datetime.utcnow()
        embed.set_footer(text='MattMaster Bots: Dnd')

        return embed
    def AbilityScores(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/ability-scores/{}'.format(name))
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(
                title='Ability Score Information - {}'.format(value['name']),
                colour=discord.Colour.red())
            # value['starting_proficiencies']
            embed.add_field(name='Short Name',
                            value=value['name'],
                            inline=False)
            embed.add_field(name='Full Name',
                            value=value['full_name'],
                            inline=False)
            embed.add_field(name='Description',
                            value=RaceHandler.DescHandler(value['desc']),
                            inline=False)
            embed.add_field(name='Skills - $Skill {value}',
                            value=RaceHandler.SkillHandler(value['skills']),
                            inline=False)

            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')

        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #5
0
    def IndexSpell(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/spells/')

        # Needs to use one or the other sometimes, -annoying
        # value = eval(value.text)
        value = json.loads(value.text)
        # CommsManager.jsonHandler(value)
        # Actual Call of discord
        if('error' not in value):
            embed = discord.Embed(
                title='Spells - {}'.format(name),
                colour=discord.Colour.red()
            )
            embed.add_field(name='Entries Found',
                            value=value['count'], inline=False)
            embed = GeneralHandler.index_Handler2(
                embed, value['results'], name)
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')
        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #6
0
    def RuleSec(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/rule-sections/{}'.format(name))
        value = json.loads(value.text)
        length = 5000
        rounds = math.ceil(len(value['desc']) / length)
        counter = 0
        embeds = []
        if('error' not in value):
            while(rounds > counter):

                embed = discord.Embed(
                    title='Damage Type Information - {}'.format(value['name']),
                    colour=discord.Colour.red()
                )
                temp = counter + 1
                embed = GeneralHandler.Desc_Handler(
                    embed, value['desc'][counter*length:temp*length], name)
                embeds.append(embed)
                counter = counter + 1
            return embeds
        else:
            embed = CommsManager.failedRequest(name)
        return [embed]
예제 #7
0
    def GeneralFeature(name):
        name = CommsManager.paramHandler(name)

        value = requests.get(
            'https://www.dnd5eapi.co/api/features/{}'.format(name))
        value = eval(value.text)

        embed = discord.Embed(title='Feature Information - {}'.format(name),
                              colour=discord.Colour.red())
        if ('error' not in value):
            embed.add_field(name='Name', value=value['name'], inline=False)
            embed.add_field(name='Class - $Class {ClassName}',
                            value=value['class']['name'],
                            inline=False)
            embed.add_field(name='Level - $Spell/Level {Level}',
                            value=str(value['level']),
                            inline=False)
            embed.add_field(name='Prerequisites',
                            value=value['prerequisites'],
                            inline=False)
            embed.add_field(name='Description',
                            value=RaceHandler.DescHandler(value['desc']),
                            inline=False)
        else:
            embed = CommsManager.failedRequest(name)
        embed.timestamp = datetime.utcnow()
        embed.set_footer(text='MattMaster Bots: Dnd')

        return embed
예제 #8
0
    def GeneralRace(name):
        """
        This will call for a general race string from the api
        Api Currently available options are
        Dragonborne,Dwarf,Elf,Gnome,Half-Elf,Halfling,Human,Tiefling
        """
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/races/{}'.format(name))
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(title='Race Information - {}'.format(
                value['name']),
                                  colour=discord.Colour.red())

            # value['starting_proficiencies']
            embed.add_field(name='Ability Bonuses - $AbilityScore {value}',
                            value=RaceHandler.abilityHandler(
                                value['ability_bonuses']),
                            inline=False)
            embed.add_field(name='Starter Proficiencies - $Prof {value}',
                            value=RaceHandler.proficienciesHandler(
                                value['starting_proficiencies']),
                            inline=False)
            embed.add_field(name='Speed', value=value['speed'], inline=False)
            embed.add_field(name='Size', value=value['size'], inline=False)
            embed.add_field(name='Size Desc',
                            value=value['size_description'],
                            inline=False)
            embed.add_field(name='Languages - $Languages {value}',
                            value=RaceHandler.languageHandler(
                                value['languages']),
                            inline=False)
            embed.add_field(name='Languages Desc',
                            value=value['language_desc'],
                            inline=False)
            embed.add_field(name='Age', value=value['age'], inline=False)
            embed.add_field(name='Alignment',
                            value=value['alignment'],
                            inline=False)
            embed.add_field(name='Traits - $Trait {value}',
                            value=RaceHandler.traitHandler(value['traits']),
                            inline=False)
            embed.add_field(name='Subraces - $Subrace {value}',
                            value=RaceHandler.SubHandler(value['subraces']),
                            inline=False)
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')

        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #9
0
    def GeneralSpell(name):
        name = CommsManager.paramHandler(name)

        value = requests.get(
            'https://www.dnd5eapi.co/api/spells/{}'.format(name))
        value = json.loads(value.text)

        if('error' not in value):
            embed = discord.Embed(
                title='Spell Information - {}'.format(value['name']),
                colour=discord.Colour.red()
            )
            embed.add_field(
                name='Level - $Spell/Level {value}', value=value['level'], inline=False)
            embed.add_field(name='Name', value=value['name'], inline=False)
            embed = GeneralHandler.Desc_Handler(embed, RaceHandler.DescHandler(
                value['desc']), name)
            if('higher_level' in value):
                embed.add_field(name='Increased Level', value=RaceHandler.DescHandler(
                    value['higher_level']), inline=False)
            if('damage' in value):
                embed.add_field(name='Damage', value=SpellsHandler.damageHandler(
                    value['damage']['damage_at_slot_level']), inline=False)
                embed.add_field(
                    name='Damage Type', value=value['damage']['damage_type']['name'], inline=False)
            embed.add_field(name='Range', value=value['range'], inline=False)
            embed.add_field(name='Components',
                            value=value['components'], inline=False)
            if('material' in value):
                embed.add_field(name='Material',
                                value=value['material'], inline=False)
            embed.add_field(
                name='Ritual?', value=value['ritual'], inline=False)
            embed.add_field(name='Duration',
                            value=value['duration'], inline=False)
            embed.add_field(name='Concentration',
                            value=value['concentration'], inline=False)
            embed.add_field(name='Casting Time',
                            value=value['casting_time'], inline=False)
            embed.add_field(
                name='School - $Spell/School {value}', value=value['school']['name'], inline=False)
            embed.add_field(
                name='Classes - $Class {value}', value=SpellsHandler.spellHandler(value['classes']), inline=False)
            embed.add_field(name='Subclasses', value=SpellsHandler.spellHandler(
                value['subclasses']), inline=False)

            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')
        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #10
0
    def GeneralSchool(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/magic-schools/{}'.format(name))
        value = json.loads(value.text)
        if ('error' not in value):
            embed = discord.Embed(title='Magic School Information - {}'.format(
                value['name']),
                                  colour=discord.Colour.red())
            embed.add_field(name='Name', value=value['name'], inline=False)

            embed = GeneralHandler.Desc_Handler(embed, value['desc'], name)
        else:
            embed = CommsManager.failedRequest(name)
        return embed
예제 #11
0
    def Traits(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/races/{}/traits/'.format(name))
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(title='{} Traits '.format(name) +
                                  '- $Traits {value}',
                                  colour=discord.Colour.red())
            embed.add_field(name='Subraces',
                            value=RaceHandler.traitHandler(value['results']))
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')

        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #12
0
    def SubClass(name):
        name = CommsManager.paramHandler(name)

        value = requests.get(
            'https://www.dnd5eapi.co/api/classes/{}/subclasses'.format(name))
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(
                title='Class SubClass List - {}'.format(name),
                colour=discord.Colour.red())
            embed.add_field(name='SubClasses',
                            value=RaceHandler.proficienciesHandler(
                                value['results']),
                            inline=False)
        else:
            embed = CommsManager.failedRequest(name)
        embed.timestamp = datetime.utcnow()
        embed.set_footer(text='MattMaster Bots: Dnd')

        return embed
예제 #13
0
    def MonsterCR(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api//monsters?challenge_rating={}'.format(
                name))
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(
                title='Monsters by CR List - CR {}'.format(name),
                colour=discord.Colour.red())
            embed.add_field(name='Monsters - $Monster {MonsterName}',
                            value=RaceHandler.proficienciesHandler(
                                value['results']),
                            inline=False)
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')
        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #14
0
    def GeneralRule(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/rules/{}'.format(name))
        value = json.loads(value.text)
        if('error' not in value):
            embed = discord.Embed(
                title='Damage Type Information - {}'.format(value['name']),
                colour=discord.Colour.red()
            )
            embed.add_field(name='Name',
                            value=value['name'], inline=False)

            if('subsections' in value):
                embed.add_field(name='SubSections - $RuleSec {Value}',
                                value=RaceHandler.proficienciesHandler(value['subsections']), inline=False)

        else:
            embed = CommsManager.failedRequest(name)
        return embed
예제 #15
0
    def AbilityScoresIndex(name):
        name = CommsManager.paramHandler(name)
        value = requests.get('https://www.dnd5eapi.co/api/ability-scores/')
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(title='Ability Score Index ',
                                  colour=discord.Colour.red())
            embed.add_field(name='Entries Found',
                            value=value['count'],
                            inline=False)
            embed.add_field(name='Results',
                            value=GeneralHandler.indexHandler(
                                value['results']),
                            inline=False)
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')

        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #16
0
    def GeneralSubClass(name):
        name = CommsManager.paramHandler(name)

        value = requests.get(
            'https://www.dnd5eapi.co/api/subclasses/{}'.format(name))
        value = eval(value.text)

        if ('error' not in value):
            embed = discord.Embed(title='Class Information - {}'.format(
                value['name']),
                                  colour=discord.Colour.red())

            embed.add_field(name='Parent Class - $Class {value}',
                            value=value['class']['name'],
                            inline=False)
            embed.add_field(name='Name', value=value['name'], inline=False)
            embed.add_field(name='Flavor Text',
                            value=value['subclass_flavor'],
                            inline=False)
            embed.add_field(name='Description',
                            value=RaceHandler.DescHandler(value['desc']),
                            inline=False)
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')
            if ('spells' in value):
                embed2 = discord.Embed(
                    title='Spell Information - {} - $Spell {}'.format(
                        value['name'], '{value}'),
                    colour=discord.Colour.red())
                embed2 = GeneralHandler.SubClassSpellHandler2(
                    embed2, value['spells'], name)
                embed2.timestamp = datetime.utcnow()
                embed2.set_footer(text='MattMaster Bots: Dnd')
                return [embed, embed2]
            else:
                return [embed]

        else:
            embed = CommsManager.failedRequest(name)
            return [embed]
예제 #17
0
    def Subrace(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/subraces/{}'.format(name))
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(title='SubRace Information - {}'.format(
                value['name']),
                                  colour=discord.Colour.red())
            # value['starting_proficiencies']
            embed.add_field(name='Parent Race - $Race {value}',
                            value=value['race']['name'],
                            inline=False)
            embed.add_field(name='Description',
                            value=value['desc'],
                            inline=False)
            embed.add_field(
                name='Starter Proficiencies - $Proficiencies {value}',
                value=RaceHandler.proficienciesHandler(
                    value['starting_proficiencies']),
                inline=False)
            embed.add_field(name='Ability Bonuses - $AbilityScore {value}',
                            value=SubRaceHandler.abilityHandler(
                                value['ability_bonuses']),
                            inline=False)
            embed.add_field(name='Languages - $Languages {value}',
                            value=value['languages'],
                            inline=False)
            embed.add_field(name='Traits - $Trait {value}',
                            value=SubRaceHandler.traitHandler(
                                value['racial_traits']),
                            inline=False)
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')

        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #18
0
    def Languages(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/languages/{}'.format(name))
        value = json.loads(value.text)
        if ('error' not in value):
            embed = discord.Embed(title='Language Information - {}'.format(
                value['name']),
                                  colour=discord.Colour.red())
            # value['starting_proficiencies']
            embed.add_field(name='Name', value=value['name'], inline=False)
            embed.add_field(name='Type', value=value['type'], inline=False)
            embed.add_field(name='Typical Speakers - $Race {value}',
                            value=LanguageHandler.raceHandler(
                                value['typical_speakers']),
                            inline=False)
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')

        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #19
0
    def MagicItem(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/magic-items/{}'.format(name))
        value = eval(value.text)

        embed = discord.Embed(title='Magic Item Information - {}'.format(name),
                              colour=discord.Colour.red())
        if ('error' not in value):
            if (value['equipment_category']['name'] == 'Weapon'):
                if ('desc' in value):
                    embed.add_field(name='Equipment Category',
                                    value=value['equipment_category']['name'],
                                    inline=False)
                    embed = GeneralHandler.Desc_Handler(
                        embed, RaceHandler.DescHandler(value['desc']), name)
                else:
                    embed.add_field(name='Equipment Category',
                                    value=value['equipment_category']['name'],
                                    inline=False)
                    embed.add_field(name='Weapon Category',
                                    value=value['weapon_category'],
                                    inline=False)
                    embed.add_field(name='Range',
                                    value=start_equip.rangeHandler(
                                        value['range']),
                                    inline=False)
                    embed.add_field(name='Category',
                                    value=value['equipment_category']['name'],
                                    inline=False)
                    embed.add_field(name='Cost',
                                    value=str(value['cost']['unit']) + ': ' +
                                    str(value['cost']['quantity']),
                                    inline=False)
                    embed.add_field(name='Damage',
                                    value=start_equip.damageHandler(
                                        value['damage']),
                                    inline=False)

            if (value['equipment_category']['name'] == 'Wondrous Item'):
                embed.add_field(name='Type',
                                value=value['equipment_category']['name'],
                                inline=False)

                embed = GeneralHandler.Desc_Handler(
                    embed, RaceHandler.DescHandler(value['desc']), name)

            if (value['equipment_category']['name'] == 'Armor'):
                embed.add_field(name='Equipment Category',
                                value=value['equipment_category']['name'],
                                inline=False)
                embed.add_field(name='Equipment Description',
                                value=RaceHandler.DescHandler(value['desc']),
                                inline=False)
            if (value['equipment_category']['name'] == 'Ammunition'):
                embed.add_field(name='Equipment Category',
                                value=value['equipment_category']['name'],
                                inline=False)
                embed.add_field(name='Equipment Description',
                                value=RaceHandler.DescHandler(value['desc']),
                                inline=False)

            if (value['equipment_category']['name'] == 'Adventuring Gear'):
                embed.add_field(name='Equipment Category',
                                value=value['equipment_category']['name'],
                                inline=False)
                embed.add_field(name='Gear Category',
                                value=value['gear_category']['name'],
                                inline=False)
                embed.add_field(name='Cost',
                                value=str(value['cost']['unit']) + ': ' +
                                str(value['cost']['quantity']),
                                inline=False)

            if (value['equipment_category']['name'] == 'Potion'):
                embed.add_field(name='Type',
                                value=value['equipment_category']['name'],
                                inline=False)

                embed = GeneralHandler.Desc_Handler(
                    embed, RaceHandler.DescHandler(value['desc']), name)

            if (value['equipment_category']['name'] == 'Wand'):
                embed.add_field(name='Equipment Category',
                                value=value['equipment_category']['name'],
                                inline=False)
                embed = GeneralHandler.Desc_Handler(
                    embed, RaceHandler.DescHandler(value['desc']), name)

            if ('contents' in value):
                embed.add_field(name='Contents',
                                value=start_equip.contentHandler(
                                    value['contents']),
                                inline=False)

        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #20
0
    def Equipment(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/equipment/{}'.format(name))
        value = json.loads(value.text)
        embed = discord.Embed(title='Equipment Information - {}'.format(name),
                              colour=discord.Colour.red())
        if ('error' not in value):
            if (value['equipment_category']['name'] == 'Weapon'):
                embed.add_field(name='Equipment Category',
                                value=value['equipment_category']['name'],
                                inline=False)
                embed.add_field(name='Weapon Category',
                                value=value['weapon_category'],
                                inline=False)
                embed.add_field(name='Range',
                                value=start_equip.rangeHandler(value['range']),
                                inline=False)
                embed.add_field(name='Category',
                                value=value['equipment_category']['name'],
                                inline=False)
                embed.add_field(name='Cost',
                                value=str(value['cost']['unit']) + ': ' +
                                str(value['cost']['quantity']),
                                inline=False)
                embed.add_field(name='Damage',
                                value=start_equip.damageHandler(
                                    value['damage']),
                                inline=False)
            if (value['equipment_category']['name'] == 'Armor'):
                embed.add_field(name='Equipment Category',
                                value=value['equipment_category']['name'],
                                inline=False)
                embed.add_field(name='Armor Category',
                                value=value['armor_category'],
                                inline=False)
                embed.add_field(name='Armor Class',
                                value=start_equip.acHandler(
                                    value['armor_class']),
                                inline=False)
                embed.add_field(name='Strength Requirement',
                                value=value['str_minimum'],
                                inline=False)
                embed.add_field(name='Stealth Disadvantage?',
                                value=value['stealth_disadvantage'],
                                inline=False)
                embed.add_field(name='cost',
                                value=str(value['cost']['unit']) + ':' +
                                str(value['cost']['quantity']),
                                inline=False)
            if (value['equipment_category']['name'] == 'Adventuring Gear'):
                embed.add_field(name='Equipment Category',
                                value=value['equipment_category']['name'],
                                inline=False)
                embed.add_field(name='Gear Category',
                                value=value['gear_category']['name'],
                                inline=False)
                embed.add_field(name='Cost',
                                value=str(value['cost']['unit']) + ': ' +
                                str(value['cost']['quantity']),
                                inline=False)

            if (value['equipment_category']['name'] == 'Mounts and Vehicles'):
                embed.add_field(name='Equipment Category',
                                value=value['equipment_category']['name'],
                                inline=False)

                embed.add_field(name='Mount and Vehicle Category',
                                value=value['vehicle_category'],
                                inline=False)

                embed.add_field(name='Cost',
                                value=str(value['cost']['unit']) + ': ' +
                                str(value['cost']['quantity']),
                                inline=False)
                if ('weight' in value):
                    embed.add_field(name='Weight',
                                    value=value['weight'],
                                    inline=False)
                if ('speed' in value):
                    embed.add_field(name='Speed',
                                    value=str(value['speed']['quantity']) +
                                    ' ' + value['speed']['unit'],
                                    inline=False)

                if ('desc' in value):
                    embed.add_field(name='Desc',
                                    value=RaceHandler.DescHandler(
                                        value['desc']),
                                    inline=False)

            if ('contents' in value):
                embed.add_field(name='Contents',
                                value=start_equip.contentHandler(
                                    value['contents']),
                                inline=False)
        else:
            embed = CommsManager.failedRequest(name)
        embed.timestamp = datetime.utcnow()
        embed.set_footer(text='MattMaster Bots: Dnd')
        return embed
예제 #21
0
    def GeneralClass(name):
        name = CommsManager.paramHandler(name)

        value = requests.get(
            'https://www.dnd5eapi.co/api/classes/{}'.format(name))
        value = eval(value.text)

        value2 = requests.get(
            'https://www.dnd5eapi.co/api/starting-equipment/{}'.format(name))
        value2 = eval(value2.text)

        if ('error' not in value):
            embed = discord.Embed(title='Class Information - {}'.format(
                value['name']),
                                  colour=discord.Colour.red())
            embed.add_field(name='Name', value=value['name'], inline=False)
            embed.add_field(name='Hit Die',
                            value='d' + str(value['hit_die']),
                            inline=False)
            embed.add_field(name='Proficiency Choices - $Prof {value}',
                            value=ProficienciesHandler.prof_choices(
                                value['proficiency_choices']),
                            inline=False)
            embed.add_field(name='Proficiencies - $Prof {value}',
                            value=RaceHandler.proficienciesHandler(
                                value['proficiencies']),
                            inline=False)
            embed.add_field(name='Saving Throws - $AbilityScore {value}',
                            value=RaceHandler.proficienciesHandler(
                                value['saving_throws']),
                            inline=False)
            embed.add_field(name='Starting Equipment - $Equip {value}',
                            value=start_equip.startEquipmentHandler(
                                value2['starting_equipment']),
                            inline=False)
            embed.add_field(name='Starting Equipment Options - $Equip {value}',
                            value=start_equip.equipmentHandler(
                                value2['starting_equipment_options']),
                            inline=False)
            if ('spellcasting' in value):
                embed.add_field(
                    name='SpellCasting Ability - $AbilityScore {value}',
                    value=value['spellcasting']['spellcasting_ability']
                    ['name'],
                    inline=False)
                embed.add_field(name='SpellCasting Desc',
                                value=SpellsHandler.dcHandler(
                                    value['spellcasting']['info']),
                                inline=False)
            embed.add_field(name='Spells - $Spell {value}',
                            value='$Class/Spell {}'.format(name),
                            inline=False)
            embed.add_field(name='SubClasses - $SubClass {value}',
                            value=RaceHandler.proficienciesHandler(
                                value['subclasses']),
                            inline=False)
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')

        else:
            embed = CommsManager.failedRequest(name)

        return embed
예제 #22
0
    def GeneralMonster(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/monsters/{}'.format(name))
        value = json.loads(value.text)
        if ('error' not in value):
            embed = discord.Embed(title='Monster Information - {}'.format(
                value['name']),
                                  colour=discord.Colour.red())
            embed.add_field(name='Name', value=value['name'], inline=False)

            embed.add_field(name='Size', value=value['size'], inline=False)
            embed.add_field(name='Type', value=value['type'], inline=False)
            embed.add_field(name='Subtype',
                            value=value['subtype'],
                            inline=False)
            embed.add_field(name='Alignment',
                            value=value['alignment'],
                            inline=False)

            embed.add_field(name='AC',
                            value=value['armor_class'],
                            inline=False)
            embed.add_field(name='HP', value=value['hit_points'], inline=False)
            embed.add_field(name='Hit Die',
                            value=value['hit_dice'],
                            inline=False)
            embed.add_field(name='Speed',
                            value=monster.moveHandler(value['speed']),
                            inline=False)

            embed.add_field(name='Ability Scores - $AbilityScore {name}',
                            value='STR: ' + str(value['strength']) +
                            ', DEX: ' + str(value['dexterity']) + ', CON: ' +
                            str(value['constitution']) + ', INT: ' +
                            str(value['intelligence']) + ', WIS: ' +
                            str(value['wisdom']) + ', CHA: ' +
                            str(value['charisma']),
                            inline=False)
            embed.add_field(name='Proficiencies',
                            value=monster.profHandler(value['proficiencies']),
                            inline=False)
            embed.add_field(
                name='DMG Vulnerabilities - $Mechanic/DamageType {value}',
                value=monster.arrayhandle(value['damage_vulnerabilities']),
                inline=False)
            embed.add_field(
                name='DMG Resistances - $Mechanic/DamageType {value}',
                value=monster.arrayhandle(value['damage_resistances']),
                inline=False)
            embed.add_field(
                name='DMG Immunities - $Mechanic/DamageType {value}',
                value=monster.arrayhandle(value['damage_immunities']),
                inline=False)

            embed.add_field(
                name='Condition Immunities - $Mechanic/Condition {name}',
                value=RaceHandler.proficienciesHandler(
                    value['condition_immunities']),
                inline=False)

            embed.add_field(name='Senses',
                            value=monster.sensesHandler(value['senses']),
                            inline=False)

            embed.add_field(name='Languages - $Language {name}',
                            value=GeneralHandler.emptyHandler(
                                value['languages']),
                            inline=False)

            embed.add_field(name='CR',
                            value=value['challenge_rating'],
                            inline=False)

            if ('special_abilities' in value):
                print(value['special_abilities'])

                counter = math.ceil(
                    len(monster.specialHandler(value['special_abilities'])) /
                    1024)
                counter2 = 0
                while (counter > counter2):
                    if (counter2 == 0):
                        temp = counter2 + 1
                        embed.add_field(
                            name='Specail Abilities',
                            value=monster.specialHandler(
                                value['special_abilities'])[counter2 *
                                                            1000:temp * 1000],
                            inline=False)
                    else:
                        temp = counter2 + 1
                        embed.add_field(
                            name='Cont...',
                            value=monster.specialHandler(
                                value['special_abilities'])[counter2 *
                                                            1000:temp * 1000],
                            inline=False)
                    counter2 = counter2 + 1

            if ('actions' in value):
                print(value['actions'])

                counter = math.ceil(
                    len(monster.attackHandler(value['actions'])) / 1024)
                counter2 = 0
                while (counter > counter2):
                    if (counter2 == 0):
                        temp = counter2 + 1
                        embed.add_field(
                            name='Actions',
                            value=monster.attackHandler(
                                value['actions'])[counter2 * 1000:temp * 1000],
                            inline=False)
                    else:
                        temp = counter2 + 1
                        embed.add_field(
                            name='Cont...',
                            value=monster.attackHandler(
                                value['actions'])[counter2 * 1000:temp * 1000],
                            inline=False)
                    counter2 = counter2 + 1

            if ('legendary_actions' in value):
                print(value['legendary_actions'])
                counter = math.ceil(
                    len(monster.specialHandler(value['legendary_actions'])) /
                    1024)
                counter2 = 0
                while (counter > counter2):
                    if (counter2 == 0):
                        temp = counter2 + 1
                        embed.add_field(
                            name='legendary_actions',
                            value=monster.specialHandler(
                                value['legendary_actions'])[counter2 *
                                                            1000:temp * 1000],
                            inline=False)
                    else:
                        temp = counter2 + 1
                        embed.add_field(
                            name='Cont...',
                            value=monster.specialHandler(
                                value['legendary_actions'])[counter2 *
                                                            1000:temp * 1000],
                            inline=False)
                    counter2 = counter2 + 1
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')
            return embed

        else:
            embed = CommsManager.failedRequest(name)
            return embed
예제 #23
0
 async def on_command_error(ctx, error):
     if isinstance(error, CommandNotFound):
         await ctx.send(embed=CommsManager.failedRequest(error))