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
Esempio n. 2
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
Esempio n. 3
0
    def Proficiencies(name):
        name = CommsManager.paramHandler(name)
        value = requests.get(
            'https://www.dnd5eapi.co/api/races/{}/proficiencies/'.format(name))
        value = eval(value.text)
        if ('error' not in value):
            embed = discord.Embed(title='{} Proficiencies '.format(name) +
                                  '- $Proficiencies {value}',
                                  colour=discord.Colour.red())
            embed.add_field(name='Proficiencies',
                            value=RaceHandler.proficienciesHandler(
                                value['results']))
            embed.timestamp = datetime.utcnow()
            embed.set_footer(text='MattMaster Bots: Dnd')

        else:
            embed = CommsManager.failedRequest(name)

        return embed
    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
    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
    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
Esempio n. 7
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
    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
    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