diff options
| author | 2019-08-12 17:15:40 -0400 | |
|---|---|---|
| committer | 2019-08-12 17:15:40 -0400 | |
| commit | 789f088a3459feb8fbbdbac0152e7dead27664ef (patch) | |
| tree | f8db2bd3b5b8cd74889be19c9c12de995987bf1f | |
| parent | Cleaned speedrun.py, removed duplicate in json file (diff) | |
removed old comment, added encoding to open statment, moved data grab to init
Diffstat (limited to '')
| -rw-r--r-- | bot/seasons/evergreen/speedrun.py | 7 | 
1 files changed, 3 insertions, 4 deletions
| diff --git a/bot/seasons/evergreen/speedrun.py b/bot/seasons/evergreen/speedrun.py index 9123bb84..3cf531bf 100644 --- a/bot/seasons/evergreen/speedrun.py +++ b/bot/seasons/evergreen/speedrun.py @@ -13,14 +13,13 @@ class Speedrun(commands.Cog):      def __init__(self, bot):          self.bot = bot +        with Path('bot/resources/evergreen/speedrun_links.json').open(encoding="utf-8") as file: +            self.data = json.load(file)      @commands.command(name="speedrun")      async def get_speedrun(self, ctx):          """Sends a link to a video of a random speedrun.""" -        with open(Path('bot/resources/evergreen/speedrun_links.json')) as file: -            data = json.load(file) -        # links = data['links'] -        await ctx.send(choice(data)) +        await ctx.send(choice(self.data))  def setup(bot): | 
