1+ from Analytics .graphics import create_plot
2+ from discord .ext import commands
3+ import discord
4+ from dataminer import bot_requests
5+
6+ class Plot (commands .Cog ):
7+ def __init__ (self , bot ):
8+ self .bot = bot
9+
10+ @commands .is_owner ()
11+ @commands .cooldown (1 , 10.0 , commands .BucketType .user )
12+ @commands .group (name = "plot" )
13+ async def _plot (self , ctx ):
14+ return
15+
16+ @commands .is_owner ()
17+ @commands .cooldown (1 , 10.0 , commands .BucketType .user )
18+ @_plot .command (name = "message" )
19+ async def _plot_message (self , ctx ):
20+ bot_requests (ctx .message , str (ctx .command ), self .bot .db )
21+ create_plot ("message" , str (ctx .guild .id ))
22+ img = discord .File (f"./src/img/{ str (ctx .guild .id )} _message.png" )
23+ return await ctx .send (file = img )
24+
25+ @commands .is_owner ()
26+ @commands .cooldown (1 , 10.0 , commands .BucketType .user )
27+ @_plot .command (name = "reaction" )
28+ async def _plot_reaction (self , ctx ):
29+ bot_requests (ctx .message , str (ctx .command ), self .bot .db )
30+ create_plot ("reaction" , str (ctx .guild .id ))
31+ img = discord .File (f"./src/img/{ str (ctx .guild .id )} _reaction.png" )
32+ return await ctx .send (file = img )
33+
34+ @commands .is_owner ()
35+ @commands .cooldown (1 , 10.0 , commands .BucketType .user )
36+ @_plot .command (name = "botrequest" , aliases = ["bot_request" , "bot-requests" ])
37+ async def _plot_botrequests (self , ctx ):
38+ bot_requests (ctx .message , str (ctx .command ), self .bot .db )
39+ create_plot ("bot_requests" ,str (ctx .guild .id ))
40+ img = discord .File (f"./src/img/{ str (ctx .guild .id )} _bot_requests.png" )
41+ return await ctx .send (file = img )
42+
43+ @commands .is_owner ()
44+ @commands .cooldown (1 , 10.0 , commands .BucketType .user )
45+ @_plot .command (name = "userjoins" , aliases = ["userjoin" ])
46+ async def _plot_userjoins (self , ctx ):
47+ bot_requests (ctx .message , str (ctx .command ), self .bot .db )
48+ create_plot ("userjoin" , str (ctx .guild .id ))
49+ img = discord .File (f"./src/img/{ str (ctx .guild .id )} _userjoins.png" )
50+ return await ctx .send (file = img )
51+
52+ @commands .is_owner ()
53+ @commands .cooldown (1 , 10.0 , commands .BucketType .user )
54+ @_plot .command (name = "userleaves" , aliases = ["userleave" ])
55+ async def _plot_userleaves (self , ctx ):
56+ bot_requests (ctx .message , str (ctx .command ), self .bot .db )
57+ create_plot ("userleave" , str (ctx .guild .id ))
58+ img = discord .File (f"./src/img/{ str (ctx .guild .id )} _userleave.png" )
59+ return await ctx .send (file = img )
60+
61+ @commands .is_owner ()
62+ @commands .cooldown (1 , 10.0 , commands .BucketType .user )
63+ @_plot .command (name = "mentions" , aliases = ["mention" ])
64+ async def _plot_mentions (self , ctx ):
65+ bot_requests (ctx .message , str (ctx .command ), self .bot .db )
66+ create_plot ("mentions" , str (ctx .guild .id ))
67+ img = discord .File (f"./src/img/{ str (ctx .guild .id )} _mentions.png" )
68+ return await ctx .send (file = img )
69+
70+ @commands .is_owner ()
71+ @commands .cooldown (1 , 10.0 , commands .BucketType .user )
72+ @_plot .command (name = "botmsg" , aliases = ["bot_msg" , "bot-msg" ])
73+ async def _plot_botmsg (self , ctx ):
74+ bot_requests (ctx .message , str (ctx .command ), self .bot .db )
75+ create_plot ("bot_msg" , str (ctx .guild .id ))
76+ img = discord .File (f"./src/img/{ str (ctx .guild .id )} _bot_msg.png" )
77+ return await ctx .send (file = img )
78+
79+ def setup (bot ):
80+ bot .add_cog (Plot (bot ))
0 commit comments