diff --git a/bot.py b/bot.py index 897a464..5e48511 100644 --- a/bot.py +++ b/bot.py @@ -123,6 +123,9 @@ async def random_message_command(ctx: commands.Context, channel: Optional[discor channel = ctx.channel messages = async_filter(_is_message_allowed_for_operations, channel.history(limit=max_cnt)) messages = [item async for item in messages] + if not messages: + await ctx.channel.send("No valid messages found!") + return msg: discord.Message = random.choice(messages) author: discord.abc.User = msg.author embed = discord.Embed(