Skip to content

Commit

Permalink
Added links to embeds, added base image to prints
Browse files Browse the repository at this point in the history
  • Loading branch information
eesandoval committed Apr 30, 2019
1 parent 4168e55 commit 011e270
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
2 changes: 2 additions & 0 deletions controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ async def process_wyrmprint_reaction(emoji, wyrmprint, message):
await process_wyrmprint(wyrmprint.name, 2, message)
elif emoji == "\U0001F50A": # 3 unbinds
await process_wyrmprint(wyrmprint.name, 3, message)
elif emoji == "\U0001F3A8": # Full base picture
await view.show_wyrmprint_base_full(wyrmprint, message)

async def process_dragon_reaction(emoji, dragon, message):
if emoji == "\U0001F5BC": # Full picture
Expand Down
6 changes: 4 additions & 2 deletions utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def update(self):
self.picture_server = config["Other"]["PictureServer"]
self.adventurer_reactions = ["\U0001F5BC", "\U0001F508",
"\U0001F509", "\U0001F50A"]
self.wyrmprint_reactions = ["\U0001F5BC", "\U0001F508",
"\U0001F509", "\U0001F50A"]
self.wyrmprint_reactions = ["\U0001F5BC", "\U0001F3A8",
"\U0001F509", "\U0001F50A",
"\U0001F508"]
self.dragon_reactions = ["\U0001F5BC", "\U0001F508", "\U0001F509"]
self.authorized_ids = config["Discord"]["AuthorizedIds"].split(',')
self.streaming = config.getboolean("Discord", "Streaming")
Expand All @@ -55,6 +56,7 @@ def update(self):
else:
self.message_limit = 1
self.limited_emoji = "<:limited:571981149497196575>"
self.gamepedia_url = "https://dragalialost.gamepedia.com/{0}"

def set_config_file(self, config_file):
project_root = dirname(dirname(__file__))
Expand Down
34 changes: 25 additions & 9 deletions view.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,10 @@ async def on_ready():

@client.event
async def show_adventurer(adventurer, message=None):
e = discord.Embed(title=adventurer.name + " - " + adventurer.title,
desc=adventurer.title)
url_name = "%20".join(adventurer.name.split())
e = discord.Embed(title=adventurer.name + " - " + adventurer.title,
desc=adventurer.title,
url=config.gamepedia_url.format(url_name))
sub_portrait_URL = "adventurers/portraits/{0}.png".format(url_name)
portrait_URL = config.picture_server + sub_portrait_URL
e.set_thumbnail(url=portrait_URL)
Expand Down Expand Up @@ -181,9 +182,10 @@ async def show_adventurer_not_found(name):

@client.event
async def show_wyrmprint(wyrmprint, message=None):
e = discord.Embed(title=wyrmprint.name,
desc=wyrmprint.name)
url_name = "%20".join(wyrmprint.name.split())
e = discord.Embed(title=wyrmprint.name,
desc=wyrmprint.name,
url=config.gamepedia_url.format(url_name))
sub_portrait_URL = "wyrmprints/portraits/{0}.png".format(url_name)
portrait_URL = config.picture_server + sub_portrait_URL
e.set_thumbnail(url=portrait_URL)
Expand All @@ -210,8 +212,9 @@ async def show_wyrmprint_not_found(name):

@client.event
async def show_dragon(dragon, message=None):
e = discord.Embed(title=dragon.name, desc=dragon.name)
url_name = "%20".join(dragon.name.split())
e = discord.Embed(title=dragon.name, desc=dragon.name,
url=config.gamepedia_url.format(url_name))
sub_portrait_URL = "dragons/portraits/{0}.png".format(url_name)
portrait_URL = config.picture_server + sub_portrait_URL
e.set_thumbnail(url=portrait_URL)
Expand Down Expand Up @@ -326,27 +329,40 @@ async def on_reaction_add(reaction, user):

@client.event
async def show_adventurer_full(adventurer, message=None):
e = discord.Embed(title=adventurer.name + " - " + adventurer.title,
desc=adventurer.title)
url_name = "%20".join(adventurer.name.split())
e = discord.Embed(title=adventurer.name + " - " + adventurer.title,
desc=adventurer.title,
url=config.gamepedia_url.format(url_name))
sub_URL = "adventurers/full/{0}.png".format(url_name)
e.set_image(url=config.picture_server + sub_URL)
await show_or_edit_adventurer(e, adventurer, message)


@client.event
async def show_wyrmprint_full(wyrmprint, message=None):
e = discord.Embed(title=wyrmprint.name, desc=wyrmprint.name)
url_name = "%20".join(wyrmprint.name.split())
e = discord.Embed(title=wyrmprint.name, desc=wyrmprint.name,
url=config.gamepedia_url.format(url_name))
sub_URL = "wyrmprints/full/{0}.png".format(url_name)
e.set_image(url=config.picture_server + sub_URL)
await show_or_edit_wyrmprint(e, wyrmprint, message)


@client.event
async def show_wyrmprint_base_full(wyrmprint, message=None):
url_name = "%20".join(wyrmprint.name.split())
e = discord.Embed(title=wyrmprint.name, desc=wyrmprint.name,
url=config.gamepedia_url.format(url_name))
sub_URL = "wyrmprints/base/{0}.png".format(url_name)
e.set_image(url=config.picture_server + sub_URL)
await show_or_edit_wyrmprint(e, wyrmprint, message)


@client.event
async def show_dragon_full(dragon, message=None):
e = discord.Embed(title=dragon.name, desc=dragon.name)
url_name = "%20".join(dragon.name.split())
e = discord.Embed(title=dragon.name, desc=dragon.name,
url=config.gamepedia_url.format(url_name))
sub_URL = "dragons/full/{0}.png".format(url_name)
e.set_image(url=config.picture_server + sub_URL)
await show_or_edit_dragon(e, dragon, message)
Expand Down

0 comments on commit 011e270

Please sign in to comment.