Update Invitarr.py

This commit is contained in:
Sleepingpirates
2020-05-12 15:59:03 -04:00
committed by GitHub
parent 97e9011be8
commit c1fba465b5

View File

@@ -8,11 +8,11 @@ from discord import Webhook, AsyncWebhookAdapter
import aiohttp import aiohttp
# settings # settings
Discord_bot_token = '' Discord_bot_token = ''
roleid = '' roleid = '' # Role Id, right click the role and copy id.
PLEXUSER = '' PLEXUSER = '' # Plex Username
PLEXPASS = '' PLEXPASS = '' # plex password
PLEX_SERVER_NAME = '' PLEX_SERVER_NAME = '' # Name of plex server
Plex_LIBS = ["Movies","TV Shows"] #name of the libraries you want the user to have access to. Plex_LIBS = ["Movies","TV Shows"] #name of the libraries you want the user to have access to.
Webhookurl = '' # For logging the user repiles, create a webhook to the discord channel you want to log this in. Webhookurl = '' # For logging the user repiles, create a webhook to the discord channel you want to log this in.
@@ -45,7 +45,7 @@ class MyClient(discord.Client):
print(email.content) #make it go to a log channel print(email.content) #make it go to a log channel
plexname = str(email.content) plexname = str(email.content)
try: try:
plex.myPlexAccount().inviteFriend(user=plexname, server=plex, sections=Plex_LIBS, allowSync=False, #your libs here plex.myPlexAccount().inviteFriend(user=plexname, server=plex, sections=Plex_LIBS, allowSync=False,
allowCameraUpload=False, allowChannels=False, filterMovies=None, allowCameraUpload=False, allowChannels=False, filterMovies=None,
filterTelevision=None, filterMusic=None) filterTelevision=None, filterMusic=None)
await asyncio.sleep(20) await asyncio.sleep(20)
@@ -55,7 +55,7 @@ class MyClient(discord.Client):
else: else:
await after.send('You have Been Added To Plex!') await after.send('You have Been Added To Plex!')
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url('Webhookurl', adapter=AsyncWebhookAdapter(session)) #webhook to a discord channel to log emails webhook = Webhook.from_url('Webhookurl', adapter=AsyncWebhookAdapter(session))
await webhook.send(plexname + ' was added to plex', username='Logger') await webhook.send(plexname + ' was added to plex', username='Logger')
client = MyClient() client = MyClient()