From 633f1e0c4b68dc0c888dd7738f560fcfa96bb545 Mon Sep 17 00:00:00 2001 From: Fixator10 Date: Thu, 11 Jun 2020 00:42:09 +0400 Subject: [PATCH] [ChatChart] make channel optional (#124) also, add concurrency --- chatchart/chatchart.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chatchart/chatchart.py b/chatchart/chatchart.py index d843da8..0aa9749 100644 --- a/chatchart/chatchart.py +++ b/chatchart/chatchart.py @@ -7,6 +7,7 @@ import discord import heapq import os from io import BytesIO +from typing import Optional import matplotlib matplotlib.use("agg") @@ -79,7 +80,8 @@ class Chatchart(commands.Cog): @commands.guild_only() @commands.command() @commands.cooldown(1, 10, commands.BucketType.channel) - async def chatchart(self, ctx, channel: discord.TextChannel = None, messages=5000): + @commands.max_concurrency(1, commands.BucketType.channel) + async def chatchart(self, ctx, channel: Optional[discord.TextChannel] = None, messages=5000): """ Generates a pie chart, representing the last 5000 messages in the specified channel. """