From 011e2700e3ae2206c612a5e7081fc70906007b66 Mon Sep 17 00:00:00 2001 From: Enrique Sandoval Date: Tue, 30 Apr 2019 10:13:18 -0700 Subject: [PATCH] Added links to embeds, added base image to prints --- controller.py | 2 ++ utils/config.py | 6 ++++-- view.py | 34 +++++++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/controller.py b/controller.py index d204b59..aefc1fa 100644 --- a/controller.py +++ b/controller.py @@ -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 diff --git a/utils/config.py b/utils/config.py index 92709a6..b4bb699 100644 --- a/utils/config.py +++ b/utils/config.py @@ -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") @@ -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__)) diff --git a/view.py b/view.py index 30f2129..2fdfacd 100644 --- a/view.py +++ b/view.py @@ -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) @@ -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) @@ -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) @@ -326,9 +329,10 @@ 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) @@ -336,17 +340,29 @@ async def show_adventurer_full(adventurer, message=None): @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)