Created
April 18, 2019 17:14
-
-
Save JakeKalkman/80719608a8fe913c01e9510f5b5a07f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sbStringBuilder(matchObjects,flag=False): | |
''' | |
:param list/object matchObjects: List or single object of soulbreak type returned by searchObject. | |
:param bool flag: True to print detailed strings, False for summary. | |
:return: list of embed objects for bot to send | |
Use: Pass a list of matched soul breaks to the string builder and it will return a list | |
of created embeds with details for the soulbreak/each soulbreak. | |
''' | |
embedList = [] | |
embed = discord.Embed(color=0x00ff00) | |
if len(matchObjects) == 0: | |
embedList.append(discord.Embed(title="No Match Found")) | |
elif len(matchObjects) > 1 and flag == False: | |
embed.title= matchObjects[0]['character'] + "'s Soulbreak Summary" | |
for match in matchObjects: | |
embed.add_field( | |
name=match['name'] + ": " + match['tier'], | |
value=match['effects'], | |
inline=False | |
) | |
embedList.append(embed) | |
elif len(matchObjects) == 1 or flag == True: | |
for match in matchObjects: | |
embed.title = match['character'] | |
embed.description = match['effects'] | |
for types in typeList: | |
if types in match: | |
embed.add_field( | |
name=typeList[types], | |
value=match[types] | |
) | |
embedList.append(embed.copy()) | |
embed = discord.Embed(color=0x00ff00) | |
else: | |
embedList.append(discord.Embed(title="No Match Found")) | |
return embedList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment