async def current_mail(self, ctx): self.log.command(f"{ctx.message.author.id}:mymail:{getUser(ctx.message.author.id)['mail']}") await ctx.message.delete() userid = str(ctx.message.author.id) if getUser(userid) != None: try: await ctx.author.send( "Your current saved mail to your Discord account is ```{0}``` You can update it anytime you want by using ```+updatemail [email protected]```".format( getUserMail(userid))) except: await ctx.send("You have to allow direct messages to use this feature!") print( "Your current saved mail to your Discord account is ```{0}``` You can update it anytime you want by using ```+updatemail [email protected]```".format( getUserMail(userid))) return True else: try: await ctx.author.send( "This user has not registered any mails yet, please use ```+addmail [email protected]``` to create your account") except: await ctx.send( "This user has not registered any mails yet, please use ```+addmail [email protected]``` to create your account") return True
async def add_mail(self, ctx, mail): await ctx.message.delete() ############################################# newUser = [str(ctx.message.author.id), mail] print("New User: "******"Such user already registered with the mail of {0}".format( newUserResMail)) await ctx.author.send( "Such user already registered with the mail of {0}".format( newUserResMail)) return True # User is registering for the first time else: print(addUser(newUser[0], newUser[1])) print("Mail has been added successfully!") await ctx.author.send("Your mail has been successfully added!") print("\n") return True
async def current_mail(self, ctx): userid = str(ctx.message.author.id) if getUser(userid) != None: await ctx.author.send( "Your current saved mail to your Discord account is ```{0}``` You can update it anytime you want by using ```+updatemail [email protected]```" .format(getUserMail(userid))) print( "Your current saved mail to your Discord account is ```{0}``` You can update it anytime you want by using ```+updatemail [email protected]```" .format(getUserMail(userid))) return True else: await ctx.author.send( "This user has not registered any mails yet, please use ```+addmail [email protected]``` to create your account" ) print( "This user has not registered any mails yet, please use ```+addmail [email protected]``` to create your account" ) return True
async def add_mail(self, ctx, *mails): if len(mails) == 1: mail = mails[0] self.log.command(f"{ctx.message.author.id}:addmail:{mail}:") await ctx.message.delete() ############################################# newUser = [str(ctx.message.author.id), mail] print("New User: "******"Such user already registered with the mail of {0}".format(newUserResMail)) try: await ctx.author.send("Such user already registered with the mail of {0}".format(newUserResMail)) except: await ctx.send("Such user already registered with this mail address") return True # User is registering for the first time else: print(addUser(newUser[0], newUser[1])) print("Mail has been added successfully!") try: await ctx.author.send("Your mail has been successfully added!") except: await ctx.send("Your mail has been successfully added!") print("\n") return True ############################################# else: print("BBBBB") try: await ctx.author.send("Dear {0}, please enter a valid mail address!".format(ctx.message.author.name)) except: await ctx.send("Dear {0}, please enter a valid mail address!".format(ctx.message.author.name))