diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/evergreen/source.py | 11 | ||||
| -rw-r--r-- | bot/exts/evergreen/trivia_quiz.py | 30 | 
2 files changed, 20 insertions, 21 deletions
| diff --git a/bot/exts/evergreen/source.py b/bot/exts/evergreen/source.py index 8fb72143..fc209bc3 100644 --- a/bot/exts/evergreen/source.py +++ b/bot/exts/evergreen/source.py @@ -33,7 +33,8 @@ class BotSource(commands.Cog):          Raise BadArgument if `source_item` is a dynamically-created object (e.g. via internal eval).          """          if isinstance(source_item, commands.Command): -            src = source_item.callback.__code__ +            callback = inspect.unwrap(source_item.callback) +            src = callback.__code__              filename = src.co_filename          else:              src = type(source_item) @@ -64,12 +65,8 @@ class BotSource(commands.Cog):          url, location, first_line = self.get_source_link(source_object)          if isinstance(source_object, commands.Command): -            if source_object.cog_name == "Help": -                title = "Help Command" -                description = source_object.__doc__.splitlines()[1] -            else: -                description = source_object.short_doc -                title = f"Command: {source_object.qualified_name}" +            description = source_object.short_doc +            title = f"Command: {source_object.qualified_name}"          else:              title = f"Cog: {source_object.qualified_name}"              description = source_object.description.splitlines()[0] diff --git a/bot/exts/evergreen/trivia_quiz.py b/bot/exts/evergreen/trivia_quiz.py index 419126dc..a8d10afd 100644 --- a/bot/exts/evergreen/trivia_quiz.py +++ b/bot/exts/evergreen/trivia_quiz.py @@ -465,22 +465,24 @@ class TriviaQuiz(commands.Cog):          Note: Only mods or the owner of the quiz can stop it.          """ -        if self.game_status[ctx.channel.id] is True: -            # Check if the author is the game starter or a moderator. -            if ctx.author == self.game_owners[ctx.channel.id] or any( -                Roles.moderator == role.id for role in ctx.author.roles -            ): - -                await ctx.send("Quiz stopped.") -                await self.declare_winner(ctx.channel, self.game_player_scores[ctx.channel.id]) - -                self.game_status[ctx.channel.id] = False -                del self.game_owners[ctx.channel.id] -                self.game_player_scores[ctx.channel.id] = {} +        try: +            if self.game_status[ctx.channel.id]: +                # Check if the author is the game starter or a moderator. +                if ctx.author == self.game_owners[ctx.channel.id] or any( +                    Roles.moderator == role.id for role in ctx.author.roles +                ): +                    self.game_status[ctx.channel.id] = False +                    del self.game_owners[ctx.channel.id] +                    self.game_player_scores[ctx.channel.id] = {} + +                    await ctx.send("Quiz stopped.") +                    await self.declare_winner(ctx.channel, self.game_player_scores[ctx.channel.id]) +                else: +                    await ctx.send(f"{ctx.author.mention}, you are not authorised to stop this game :ghost:!")              else: -                await ctx.send(f"{ctx.author.mention}, you are not authorised to stop this game :ghost:!") -        else: +                await ctx.send("No quiz running.") +        except KeyError:              await ctx.send("No quiz running.")      @quiz_game.command(name="leaderboard") | 
