fixed bugs
This commit is contained in:
@@ -109,18 +109,6 @@ class app(commands.Cog):
|
|||||||
await self.embederror(channel, 'Invalid email.')
|
await self.embederror(channel, 'Invalid email.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def addtoplexhome(self, email, channel):
|
|
||||||
if(plexhelper.verifyemail(email)):
|
|
||||||
if plexhelper.plexhomeadd(plex,email,Plex_LIBS):
|
|
||||||
await self.embedinfo(channel, 'This email address has been added to plex home')
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
await self.embederror(channel, 'There was an error adding this email address. Check logs.')
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
await self.embederror(channel, 'Invalid email.')
|
|
||||||
return False
|
|
||||||
|
|
||||||
async def removefromplex(self, email, channel):
|
async def removefromplex(self, email, channel):
|
||||||
if(plexhelper.verifyemail(email)):
|
if(plexhelper.verifyemail(email)):
|
||||||
if plexhelper.plexremove(plex,email):
|
if plexhelper.plexremove(plex,email):
|
||||||
@@ -132,18 +120,6 @@ class app(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
await self.embederror(channel, 'Invalid email.')
|
await self.embederror(channel, 'Invalid email.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def removefromplexhome(self, email, channel):
|
|
||||||
if(plexhelper.verifyemail(email)):
|
|
||||||
if plexhelper.plexremovehome(plex,email):
|
|
||||||
await self.embedinfo(channel, 'This email address has been removed from plex home.')
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
await self.embederror(channel, 'There was an error removing this email address. Check logs.')
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
await self.embederror(channel, 'Invalid email.')
|
|
||||||
return False
|
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_member_update(self, before, after):
|
async def on_member_update(self, before, after):
|
||||||
@@ -202,16 +178,6 @@ class app(commands.Cog):
|
|||||||
async def plexremove(self, ctx, email):
|
async def plexremove(self, ctx, email):
|
||||||
await self.removefromplex(email, ctx.channel)
|
await self.removefromplex(email, ctx.channel)
|
||||||
|
|
||||||
@commands.has_permissions(administrator=True)
|
|
||||||
@commands.command(aliases=['plexaddhome'])
|
|
||||||
async def plexinvitehome(self, ctx, email):
|
|
||||||
await self.addtoplexhome(email, ctx.channel)
|
|
||||||
|
|
||||||
@commands.has_permissions(administrator=True)
|
|
||||||
@commands.command(aliases=['plexrmhome'])
|
|
||||||
async def plexremovehome(self, ctx, email):
|
|
||||||
await self.removefromplexhome(email, ctx.channel)
|
|
||||||
|
|
||||||
@commands.has_permissions(administrator=True)
|
@commands.has_permissions(administrator=True)
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def dbadd(self, ctx, email, member: discord.Member):
|
async def dbadd(self, ctx, email, member: discord.Member):
|
||||||
|
|||||||
@@ -14,27 +14,6 @@ def plexadd(plex, plexname, Plex_LIBS):
|
|||||||
print(e)
|
print(e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def plexhomeadd(plex, plexname, Plex_LIBS):
|
|
||||||
try:
|
|
||||||
if Plex_LIBS[0] == "all":
|
|
||||||
Plex_LIBS = plex.library.sections()
|
|
||||||
plex.myPlexAccount().createHomeUser(user=plexname, server=plex, sections=Plex_LIBS, allowSync=False,
|
|
||||||
allowCameraUpload=False, allowChannels=False, filterMovies=None,
|
|
||||||
filterTelevision=None, filterMusic=None)
|
|
||||||
print(plexname +' has been added to plex home')
|
|
||||||
return True
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def plexremovehome(plex, plexname):
|
|
||||||
try:
|
|
||||||
plex.myPlexAccount().removeFriend(user=plexname)
|
|
||||||
print(plexname +' has been removed from plex home')
|
|
||||||
return True
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def plexremove(plex, plexname):
|
def plexremove(plex, plexname):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user