added new env ownerid
This commit is contained in:
committed by
repl.it user
parent
f84206f639
commit
bb7ec53d96
@@ -16,6 +16,7 @@ PLEXPASS = environ.get('PLEXPASS') # plex password
|
|||||||
PLEX_SERVER_NAME = environ.get('PLEX_SERVER_NAME') # Name of plex server
|
PLEX_SERVER_NAME = environ.get('PLEX_SERVER_NAME') # Name of plex server
|
||||||
Plex_LIBS = environ.get('Plex_LIBS') #name of the libraries you want the user to have access to.
|
Plex_LIBS = environ.get('Plex_LIBS') #name of the libraries you want the user to have access to.
|
||||||
chan = int(environ.get('channelid'))
|
chan = int(environ.get('channelid'))
|
||||||
|
ownerid = int(environ.get('ownerid'))
|
||||||
auto_remove_user = environ.get('autoremoveuser') if environ.get('autoremoveuser') else False # auto remove user from plex and db if removed from the role
|
auto_remove_user = environ.get('autoremoveuser') if environ.get('autoremoveuser') else False # auto remove user from plex and db if removed from the role
|
||||||
|
|
||||||
li = list(Plex_LIBS.split(','))
|
li = list(Plex_LIBS.split(','))
|
||||||
@@ -104,6 +105,25 @@ class MyClient(discord.Client):
|
|||||||
if message.author.id == self.user.id:
|
if message.author.id == self.user.id:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if message.author.id == ownerid:
|
||||||
|
|
||||||
|
if message.content.startswith('-dbadd'):
|
||||||
|
mgs = message.content.replace('-dbadd ','')
|
||||||
|
try:
|
||||||
|
mgs = mgs.split(' ')
|
||||||
|
email = mgs[0]
|
||||||
|
bad_chars = ['<','>','@','!']
|
||||||
|
user_id = mgs[1]
|
||||||
|
for i in bad_chars:
|
||||||
|
user_id = user_id.replace(i, '')
|
||||||
|
db.save_user(user_id, email)
|
||||||
|
await message.channel.send('The user has been added to db!')
|
||||||
|
except:
|
||||||
|
await message.channel.send('Cannot add this user to db.')
|
||||||
|
print("Cannot add this user to db.")
|
||||||
|
await message.delete()
|
||||||
|
|
||||||
|
|
||||||
if str(message.channel) == str(secure):
|
if str(message.channel) == str(secure):
|
||||||
if message.content.startswith('-plexadd'):
|
if message.content.startswith('-plexadd'):
|
||||||
mgs = message.content.replace('-plexadd ','')
|
mgs = message.content.replace('-plexadd ','')
|
||||||
@@ -118,19 +138,6 @@ class MyClient(discord.Client):
|
|||||||
else:
|
else:
|
||||||
message.channel.send('Error Check Logs! {0.author.mention}'.format(message))
|
message.channel.send('Error Check Logs! {0.author.mention}'.format(message))
|
||||||
|
|
||||||
if message.content.startswith('-dbadd'):
|
|
||||||
mgs = message.content.replace('-dbadd ','')
|
|
||||||
try:
|
|
||||||
mgs = mgs.split(' ')
|
|
||||||
email = mgs[0]
|
|
||||||
bad_chars = ['<','>','@','!']
|
|
||||||
user_id = mgs[1]
|
|
||||||
for i in bad_chars:
|
|
||||||
user_id = user_id.replace(i, '')
|
|
||||||
db.save_user(user_id, email)
|
|
||||||
await message.channel.send('The user {} has been added to db!'.format(mgs[0]))
|
|
||||||
except:
|
|
||||||
print("Cannot add this user to db.")
|
|
||||||
|
|
||||||
async def on_member_remove(self, member):
|
async def on_member_remove(self, member):
|
||||||
if auto_remove_user:
|
if auto_remove_user:
|
||||||
|
|||||||
Reference in New Issue
Block a user