diff options
| author | 2021-09-05 00:31:20 -0400 | |
|---|---|---|
| committer | 2021-09-05 00:31:20 -0400 | |
| commit | 02512e43f3d68ffd89654c5f2e9e3e9a27c0c018 (patch) | |
| tree | 4b62a6dbb39601f02aa435c7eb8a10433585c3bb /bot/exts/evergreen/recommend_game.py | |
| parent | Move snakes commands into fun folder (diff) | |
Move game and fun commands to Fun folder, fix ddg
This moves all the fun commands and games into the fun folder.
This commit also makes changes to the duck_game.
It was setting a footer during an embed init, which is no longer
possible with the version of d.py we use. Additionally, an issue with
editing an embed that had a local image loaded.
The workaround for the time being is to update the message,
not the embed.
Diffstat (limited to 'bot/exts/evergreen/recommend_game.py')
| -rw-r--r-- | bot/exts/evergreen/recommend_game.py | 51 | 
1 files changed, 0 insertions, 51 deletions
| diff --git a/bot/exts/evergreen/recommend_game.py b/bot/exts/evergreen/recommend_game.py deleted file mode 100644 index bdd3acb1..00000000 --- a/bot/exts/evergreen/recommend_game.py +++ /dev/null @@ -1,51 +0,0 @@ -import json -import logging -from pathlib import Path -from random import shuffle - -import discord -from discord.ext import commands - -from bot.bot import Bot - -log = logging.getLogger(__name__) -game_recs = [] - -# Populate the list `game_recs` with resource files -for rec_path in Path("bot/resources/evergreen/game_recs").glob("*.json"): -    data = json.loads(rec_path.read_text("utf8")) -    game_recs.append(data) -shuffle(game_recs) - - -class RecommendGame(commands.Cog): -    """Commands related to recommending games.""" - -    def __init__(self, bot: Bot): -        self.bot = bot -        self.index = 0 - -    @commands.command(name="recommendgame", aliases=("gamerec",)) -    async def recommend_game(self, ctx: commands.Context) -> None: -        """Sends an Embed of a random game recommendation.""" -        if self.index >= len(game_recs): -            self.index = 0 -            shuffle(game_recs) -        game = game_recs[self.index] -        self.index += 1 - -        author = self.bot.get_user(int(game["author"])) - -        # Creating and formatting Embed -        embed = discord.Embed(color=discord.Colour.blue()) -        if author is not None: -            embed.set_author(name=author.name, icon_url=author.display_avatar.url) -        embed.set_image(url=game["image"]) -        embed.add_field(name=f"Recommendation: {game['title']}\n{game['link']}", value=game["description"]) - -        await ctx.send(embed=embed) - - -def setup(bot: Bot) -> None: -    """Loads the RecommendGame cog.""" -    bot.add_cog(RecommendGame(bot)) | 
