aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks123 <[email protected]>2020-03-04 09:54:15 +0200
committerGravatar ks123 <[email protected]>2020-03-04 09:54:15 +0200
commit69941d874d708defaa20e30fe4afada37b72ad2a (patch)
tree8f7999b9aca97f56d5c8a7f042cdfa8fe8373aed
parent(Games Cog): Created task for fetching genres (every hour) (diff)
(Games Cog): Added .games refresh|r command for refreshing genres.
-rw-r--r--bot/seasons/evergreen/game.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/bot/seasons/evergreen/game.py b/bot/seasons/evergreen/game.py
index 727985a3..de8d0109 100644
--- a/bot/seasons/evergreen/game.py
+++ b/bot/seasons/evergreen/game.py
@@ -13,7 +13,8 @@ from discord.ext import tasks
from discord.ext.commands import Cog, Context, group
from bot.bot import SeasonalBot
-from bot.constants import Tokens
+from bot.constants import STAFF_ROLES, Tokens
+from bot.decorators import with_role
from bot.pagination import ImagePaginator, LinePaginator
# Base URL of IGDB API
@@ -252,6 +253,17 @@ class Games(Cog):
await ImagePaginator.paginate(pages, ctx, Embed(title="Random Game Companies"))
+ @with_role(*STAFF_ROLES)
+ @games.command(name="refresh", aliases=["r"])
+ async def refresh_genres_command(self, ctx: Context) -> None:
+ """Refresh .games command genres."""
+ try:
+ await self._get_genres()
+ except Exception as e:
+ await ctx.send(f"There was error while refreshing genres: `{e}`")
+ return
+ await ctx.send("Successfully refreshed genres.")
+
async def get_games_list(self,
amount: int,
genre: Optional[str] = None,