Skip to content

Commit

Permalink
added analyticsuser
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevalicjus committed Jan 12, 2022
1 parent 1c2d35c commit a14ada8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cogs/other.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a14ada8

Please sign in to comment.