added command to update plex libs
This commit is contained in:
@@ -17,7 +17,7 @@ roles = None
|
|||||||
PLEXUSER = ""
|
PLEXUSER = ""
|
||||||
PLEXPASS = ""
|
PLEXPASS = ""
|
||||||
PLEX_SERVER_NAME = ""
|
PLEX_SERVER_NAME = ""
|
||||||
Plex_LIBS = ["all"]
|
Plex_LIBS = None
|
||||||
|
|
||||||
if(path.exists('app/config/config.ini')):
|
if(path.exists('app/config/config.ini')):
|
||||||
try:
|
try:
|
||||||
@@ -33,6 +33,11 @@ if(path.exists('app/config/config.ini')):
|
|||||||
roles = config.get(BOT_SECTION, 'roles')
|
roles = config.get(BOT_SECTION, 'roles')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
if(path.exists('app/config/config.ini')):
|
||||||
|
try:
|
||||||
|
Plex_LIBS = config.get(BOT_SECTION, 'plex_libs')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
account = MyPlexAccount(PLEXUSER, PLEXPASS)
|
account = MyPlexAccount(PLEXUSER, PLEXPASS)
|
||||||
@@ -44,6 +49,11 @@ except:
|
|||||||
if roles is not None:
|
if roles is not None:
|
||||||
roles = list(roles.split(','))
|
roles = list(roles.split(','))
|
||||||
|
|
||||||
|
if Plex_LIBS is None:
|
||||||
|
Plex_LIBS = ["all"]
|
||||||
|
else:
|
||||||
|
Plex_LIBS = list(Plex_LIBS.split(', '))
|
||||||
|
print(Plex_LIBS)
|
||||||
class app(commands.Cog):
|
class app(commands.Cog):
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ roles = None
|
|||||||
PLEXUSER = ""
|
PLEXUSER = ""
|
||||||
PLEXPASS = ""
|
PLEXPASS = ""
|
||||||
PLEX_SERVER_NAME = ""
|
PLEX_SERVER_NAME = ""
|
||||||
Plex_LIBS = ["all"]
|
Plex_LIBS = None
|
||||||
switch = 0
|
switch = 0
|
||||||
|
|
||||||
|
|
||||||
@@ -59,7 +59,11 @@ if(path.exists('app/config/config.ini')):
|
|||||||
roles = config.get(BOT_SECTION, 'roles')
|
roles = config.get(BOT_SECTION, 'roles')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
if(path.exists('app/config/config.ini')):
|
||||||
|
try:
|
||||||
|
Plex_LIBS = config.get(BOT_SECTION, 'plex_libs')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
def get_config():
|
def get_config():
|
||||||
"""
|
"""
|
||||||
Function to return current config
|
Function to return current config
|
||||||
|
|||||||
16
run.py
16
run.py
@@ -90,6 +90,20 @@ async def setupplex(ctx):
|
|||||||
reload()
|
reload()
|
||||||
await ctx.author.send("Bot has been restarted. Give it a few seconds. Please check logs and make sure you see the line: `Logged into plex`. If not run this command again and make sure you enter the right values. ")
|
await ctx.author.send("Bot has been restarted. Give it a few seconds. Please check logs and make sure you see the line: `Logged into plex`. If not run this command again and make sure you enter the right values. ")
|
||||||
print("Bot has been restarted. Give it a few seconds.")
|
print("Bot has been restarted. Give it a few seconds.")
|
||||||
|
|
||||||
|
@bot.command()
|
||||||
|
@commands.has_permissions(administrator=True)
|
||||||
|
async def setuplibs(ctx):
|
||||||
|
libs = ""
|
||||||
|
libs = await getplex(ctx, "libs")
|
||||||
|
if libs is None:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
confighelper.change_config("plex_libs", str(libs))
|
||||||
|
print("Plex libraries updated. Restarting bot.")
|
||||||
|
reload()
|
||||||
|
await ctx.author.send("Bot has been restarted. Give it a few seconds. Please check logs and make sure you see the line: `Logged into plex`. If not run this command again and make sure you enter the right values. ")
|
||||||
|
print("Bot has been restarted. Give it a few seconds.")
|
||||||
|
|
||||||
bot.load_extension(f'app.bot.cogs.app')
|
bot.load_extension(f'app.bot.cogs.app')
|
||||||
bot.run(Discord_bot_token)
|
bot.run(Discord_bot_token)
|
||||||
Reference in New Issue
Block a user