Fixed Plex_LIBS bug

This commit is contained in:
Faiz Ahmed
2021-07-26 14:07:02 -04:00
parent 7ae7b41268
commit 86e8d29117
2 changed files with 4 additions and 6 deletions

View File

@@ -99,7 +99,7 @@ class app(commands.Cog):
async def addtoplex(self, email, channel): async def addtoplex(self, email, channel):
if(plexhelper.verifyemail(email)): if(plexhelper.verifyemail(email)):
if plexhelper.plexadd(plex,email): if plexhelper.plexadd(plex,email,Plex_LIBS):
await self.embedinfo(channel, 'This email address has been added to plex') await self.embedinfo(channel, 'This email address has been added to plex')
return True return True
else: else:
@@ -111,7 +111,7 @@ class app(commands.Cog):
async def removefromplex(self, email, channel): async def removefromplex(self, email, channel):
if(plexhelper.verifyemail(email)): if(plexhelper.verifyemail(email)):
if plexhelper.plexadd(plex,email): if plexhelper.plexremove(plex,email):
await self.embedinfo(channel, 'This email address has been removed from plex.') await self.embedinfo(channel, 'This email address has been removed from plex.')
return True return True
else: else:
@@ -136,7 +136,7 @@ class app(commands.Cog):
email = await self.getemail(after) email = await self.getemail(after)
if email is not None: if email is not None:
await self.embedinfo(after, "Got it we will be adding your email to plex shortly!") await self.embedinfo(after, "Got it we will be adding your email to plex shortly!")
if plexhelper.plexadd(plex,email): if plexhelper.plexadd(plex,email,Plex_LIBS):
db.save_user(str(after.id), email) db.save_user(str(after.id), email)
await asyncio.sleep(5) await asyncio.sleep(5)
await self.embedinfo(after, 'You have Been Added To Plex! Login to plex and accept the invite!') await self.embedinfo(after, 'You have Been Added To Plex! Login to plex and accept the invite!')

View File

@@ -1,9 +1,7 @@
from plexapi.myplex import MyPlexAccount from plexapi.myplex import MyPlexAccount
import re import re
from app.bot.helper.confighelper import Plex_LIBS
def plexadd(plex, plexname): def plexadd(plex, plexname, Plex_LIBS):
global Plex_LIBS
try: try:
if Plex_LIBS[0] == "all": if Plex_LIBS[0] == "all":
Plex_LIBS = plex.library.sections() Plex_LIBS = plex.library.sections()