From a14ada8cd3007eb3ba55a6b42d1e7c7e5ba196a8 Mon Sep 17 00:00:00 2001 From: Nevalicjus <50320623+Nevalicjus@users.noreply.github.com> Date: Wed, 12 Jan 2022 15:30:40 +0100 Subject: [PATCH] added analyticsuser --- cogs/other.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/cogs/other.py b/cogs/other.py index 29458e2..f2d7b94 100644 --- a/cogs/other.py +++ b/cogs/other.py @@ -593,6 +593,36 @@ async def analyticslog_err_handler(self, ctx, error): if isinstance(error, commands.ChannelNotFound): await ctx.send("Channel you are trying to mention or provide ID of doesn't exist") + @commands.command() + async def analyticsuser(self, ctx, inviter: discord.Member): + if self.checkInvos(ctx.guild.id) == 1: + await ctx.message.delete(delay=3) + + with open(f"users/{ctx.guild.id}.json", 'r') as f: + users = json.load(f) + + if f"{inviter.id}" in list(users.keys()): + numofinvitedby = users[f"{inviter.id}"] + + flex = "people" + if numofinvitedby == 1: + flex = "person" + embed = self.constructResponseEmbedBase(f"{inviter.mention} has invited {numofinvitedby} {flex} 🎉") + else: + embed = self.constructResponseEmbedBase(f"{inviter.mention} hans't invited anyone yet") + + await ctx.send(embed = embed) + + @analyticsuser.error + async def analyticsuser_err_handler(self, ctx, error): + if isinstance(error, commands.MissingRequiredArgument): + if error.param.name == "inviter": + await ctx.send("Your command is missing a required argument: a valid user (User mention or User ID)") + if isinstance(error, commands.MemberNotFound): + await ctx.send("User you are trying to mention or provide ID of doesn't exist") + if isinstance(error, commands.UserNotFound): + await ctx.send("User you are trying to mention or provide ID of doesn't exist") + @commands.command() #------------------------------ # Change bot's server-prefix