diff --git a/.gitignore b/.gitignore index 47b6d54..bc90f0c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,5 @@ KickScreenshot.jpg ofScreenshot.jpg NoDriverTest.py AppConstants.py -tests \ No newline at end of file +tests +.dockerignore \ No newline at end of file diff --git a/DefaultConstants.py b/DefaultConstants.py index b92d29b..5c93276 100644 --- a/DefaultConstants.py +++ b/DefaultConstants.py @@ -18,14 +18,28 @@ class Constants: BC_NOTIFICATION_CHANNEL_ID = 1137599805787480214 SC_NOTIFICATION_CHANNEL_ID = 1137599805787480214 EP_NOTIFICATION_CHANNEL_ID = 1137599805787480214 + MV_NOTIFICATION_CHANNEL_ID = 1137599805787480214 CONFESSTION_CHANNEL_ID = 1137599805787480214 CONFESSION_COMMAND_ID = 1159423004346957835 CONFESS_REVIEW_COMMAND_ID = 1159423004346957834 - - KICK_PROXY = "" - FANS_PROXY = "127.0.0.1:8888" - OF_PROXY = "" + + # Leave an empty string if you don't wish to use a proxy for a checker. + # Kick/OF/Fansly use nodriver, which doesn't support authenticated proxies + # All the other platforms assumes you're using a socks5 proxy, so you can leave out the socks5:// part + # Commented out platforms don't support proxies + KICK_PROXY = "" # Chrome/Chromium doesn't support authenticated proxies + FANS_PROXY = "127.0.0.1:8888" # Chrome/Chromium doesn't support authenticated proxies + OF_PROXY = "" # Chrome/Chromium doesn't support authenticated proxies + #CB_PROXY = "" # Everything below assumed is a socks5 proxy. + MV_PROXY = "" + BC_PROXY = "" + SC_PROXY = "" + EP_PROXY = "" + CAM4_PROXY = "" + MFC_PROXY = "" + #YT_PROXY = "" + #TWITCH_PROXY = "" else: GUILD_ID =1058859922219081778 #Guild ID of the discord server whiteListedRoleIDs = [1062179283705020486,145802742647095296,1100148453792813086,245364417783398400] # IDs of Roles you wish to be white listed for some commands. You can also add user IDs if you want to add an individual without a role @@ -41,14 +55,28 @@ class Constants: BC_NOTIFICATION_CHANNEL_ID = 1268796965743886448 SC_NOTIFICATION_CHANNEL_ID = 1268796965743886448 EP_NOTIFICATION_CHANNEL_ID = 1268796965743886448 + MV_NOTIFICATION_CHANNEL_ID = 1268796965743886448 CONFESSTION_CHANNEL_ID = 1158240422997528637 CONFESSION_COMMAND_ID = 1159321755270250571 CONFESS_REVIEW_COMMAND_ID = 1159321755270250570 - - KICK_PROXY = "" - FANS_PROXY = "127.0.0.1:8888" - OF_PROXY = "" + + # Leave an empty string if you don't wish to use a proxy for a checker. + # Kick/OF/Fansly use nodriver, which doesn't support authenticated proxies + # All the other platforms assumes you're using a socks5 proxy, so you can leave out the socks5:// part + # Commented out platforms don't support proxies + KICK_PROXY = "" # Chrome/Chromium doesn't support authenticated proxies + FANS_PROXY = "127.0.0.1:8888" # Chrome/Chromium doesn't support authenticated proxies + OF_PROXY = ""# Chrome/Chromium doesn't support authenticated proxies + #CB_PROXY = "" # Everything below assumed is a socks5 proxy. + MV_PROXY = "" + BC_PROXY = "" + SC_PROXY = "" + EP_PROXY = "" + CAM4_PROXY = "" + MFC_PROXY = "" + #YT_PROXY = "" + #TWITCH_PROXY = "" WAIT_BETWEEN_MESSAGES = 1800 # minimum amount of time in seconds the stream has to be offline before new notification messages. MIN_TIME_BEFORE_AVATAR_CHANGE = 48 # Minimum time before avatar changes -- in hours @@ -74,6 +102,7 @@ class Constants: BC_CHECK_TIMER = 180 SC_CHECK_TIMER = 180 EP_CHECK_TIMER = 180 + MV_CHECK_TIMER = 180 AVATAR_CHECK_TIMER = 130 # Timer for checking last online time before changing between happy/angry avatars STATUS_CHECK_TIMER = 125 # Timer for checking online status and changing the bot status. Also used for record keeping @@ -107,6 +136,7 @@ class Constants: BC_ROLES_TO_PING = "@everyone " SC_ROLES_TO_PING = "@everyone " EP_ROLES_TO_PING = "@everyone " + MV_ROLES_TO_PING = "@everyone " # For rerun announcements/pings to work you will first need to turn them on via the /announce-rerun-toggle True/False command AND the /ping-toggle True/False command. # if you don't want a specific platform to get a rerun ping, just leave an empty string (It will still get announced if turned on) @@ -125,6 +155,7 @@ class Constants: BC_RERUN_ROLES_TO_PING = "" SC_RERUN_ROLES_TO_PING = "" EP_RERUN_ROLES_TO_PING = "" + MV_RERUN_ROLES_TO_PING = "" #Generic name of the streamer that will be used for all notifications streamerName = "LitneySpears" @@ -142,6 +173,7 @@ class Constants: bcUserName = [] scUserName = [] epUserName = [] + mvUserName = [] #case sensitive if you want the the avatar to be pulled twitchUrl = f"https://www.twitch.tv/litneyspears_" #Add a valid twitch URL here even if you streamer doesn't have twitch or else the presence won't update properly @@ -163,6 +195,7 @@ class Constants: bcEmbedColor = "#97323a" scEmbedColor = "#a02831" epEmbedColor = "#f03d4c" + mvEmbedColor = "#722a9e" # Mainly Used in stream-status command linkTreeUrl = "https://allmylinks.com/litneyspears" @@ -178,6 +211,7 @@ class Constants: bcDefaultTitle = "BongaCams Fun Time." scDefaultTitle = "StripChat Fun Time." epDefaultTitle = "ePlay Fun Time." + mvDefaultTitle = "Manyvids Fun Time Starts Now!" # This is the text that will appear above the embed. Role mentions will be added before this text, and a link to the stream will be added after # i.e. @everyone https://kick.com/StreamerName @@ -192,6 +226,7 @@ class Constants: bcAboveEmbedText = f"{streamerName} is live on BongaCams!" scAboveEmbedText = f"{streamerName} is live on StripChat!" epAboveEmbedText = f"{streamerName} is live on ePlay!" + mvAboveEmbedText = f"{streamerName} is live on ManyVids!" # This is small text that will appear below the title, and above the main image inside the embed. kickBelowTitleText = f"{streamerName} is now live on Kick!" @@ -205,6 +240,7 @@ class Constants: bcBelowTitleText = f"{streamerName} is now live on BongaCams!" scBelowTitleText = f"{streamerName} is now live on StripChat!" epBelowTitleText = f"{streamerName} is now live on ePlay!" + mvBelowTitleText = f"{streamerName} is now live on ManyVids!" # Leave empty strings if you want to use default thumbnail behavior; which is: (1)pull thumbnail from platform, (2)if it doesn't exist use image from image list, (3)if list empty use defaultThumbnail # Add your own image path/url if you want to exclusively use the same image over and over for a specific platform's thumbnail @@ -220,6 +256,7 @@ class Constants: bcThumbnail = "" scThumbnail = "" epThumbnail = "" + mvThumbnail = "" # Icon in this case is the small image that shows in the top left of the imbed before the streamer's name for that platform # This is used if an avatar/icon can't be found on a platform, otherwise the platform's version will be used diff --git a/Dockerfile b/Dockerfile index 8cfc2a5..5ae6675 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,31 @@ -# syntax=docker/dockerfile:1 -FROM python:3.11.3-slim +# Build Stage +FROM python:3.11.3-slim AS build ENV DEBIAN_FRONTEND=noninteractive -# Install dependencies -RUN apt update -y -RUN apt install -y chromium xvfb git +RUN apt update -y && apt install -y git -WORKDIR /opt/SassBot -COPY . . +RUN python3 -m venv /venv +ENV PATH=/venv/bin:$PATH -# Clone repo and install requirements +COPY requirements.txt . RUN pip install -r requirements.txt && \ pip install uvloop +# Buidling final image, moving over venv +FROM python:3.11.3-slim + +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /opt/SassBot + +RUN apt update -y && apt install -y --no-install-recommends chromium xvfb + +COPY --from=build /venv /venv +ENV PATH=/venv/bin:$PATH + +COPY . . + RUN chmod +x docker-entrypoint.sh ENTRYPOINT ["/bin/sh", "-c", "./docker-entrypoint.sh"] \ No newline at end of file diff --git a/GenerateDatabase.py b/GenerateDatabase.py index 41fa9d1..5d29c1e 100644 --- a/GenerateDatabase.py +++ b/GenerateDatabase.py @@ -92,7 +92,8 @@ ("mfc",0,0,0), ("bongacams",0,0,0), ("stripchat",0,0,0), - ("eplay",0,0,0) + ("eplay",0,0,0), + ("manyvids",0,0,0) ] subathon_values =[ (0,0,0,0,None) diff --git a/README.MD b/README.MD index 8ebf0c3..4346776 100644 --- a/README.MD +++ b/README.MD @@ -12,6 +12,7 @@ - BongaCams - StripChat - ePlay +- ManyVids ### Features - Get notifications when your streamer is online sent to a discord channel - Rerun detection/support. If stream titles contains a variation of rerun/rr/not live then it will be detected as a rerun. @@ -97,6 +98,13 @@ 4. If the requesting ip is in a state that requires age verification, some of these checkers wont work. ### Update History +- 10/22/2024 + - Added ManyVids Support + - Because of this many things have changed in Default/App Constants so they will need to be updated with new vars + - Added proxy support for most of the checkers. Anything that doesn't use nodriver will use socks5 + - Changed requirements update them with 'pip install -U -r requirements.txt' + - Change nodriver temp file behavior. Uses default behavior in windows + - Changed Dockerfile to improve size and fixed docker image to work with windows - 10/19/2024 - Improvements on Twitch checker to hopefully work more quickly - Improvements with nodriver temp folders (was previously taking up too much disk space) diff --git a/checkers/Bongacams.py b/checkers/Bongacams.py index cb8d69b..262fcf6 100644 --- a/checkers/Bongacams.py +++ b/checkers/Bongacams.py @@ -9,6 +9,7 @@ from utils.NoDriverBrowserCreator import getUserAgent import logging from utils.StaticMethods import GetThumbnail +from utils.StaticMethods import GetProxies logger = logging.getLogger(__name__) logger.setLevel(Constants.SASSBOT_LOG_LEVEL) @@ -21,7 +22,10 @@ def isModelOnline(bcUserName): agent = getUserAgent() headers = {"User-Agent": agent} try: - page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers) + if Constants.BC_PROXY: + page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers, proxies=GetProxies(Constants.BC_PROXY)) + else: + page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers) time.sleep(1) if page.status_code == 200: soup = BeautifulSoup(page.content, "html.parser") diff --git a/checkers/Cam4.py b/checkers/Cam4.py index 5bb5e46..bbb5895 100644 --- a/checkers/Cam4.py +++ b/checkers/Cam4.py @@ -9,6 +9,7 @@ from utils.NoDriverBrowserCreator import getUserAgent import logging from utils.StaticMethods import GetThumbnail +from utils.StaticMethods import GetProxies logger = logging.getLogger(__name__) logger.setLevel(Constants.SASSBOT_LOG_LEVEL) @@ -21,7 +22,10 @@ def isModelOnline(cam4UserName): agent = getUserAgent() try: headers = {"User-Agent": agent} - results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers) + if Constants.CAM4_PROXY: + results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers, proxies=GetProxies(Constants.CAM4_PROXY)) + else: + results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers) time.sleep(1) try: cam4Json = results.json() diff --git a/checkers/Eplay.py b/checkers/Eplay.py index f1538d4..78a92f3 100644 --- a/checkers/Eplay.py +++ b/checkers/Eplay.py @@ -8,6 +8,7 @@ import json import logging from utils.StaticMethods import GetThumbnail +from utils.StaticMethods import GetProxies logger = logging.getLogger(__name__) logger.setLevel(Constants.SASSBOT_LOG_LEVEL) @@ -18,13 +19,19 @@ def isModelOnline(epUserName): tempThumbUrl = "" icon = Constants.defaultIcon try: - request = requests.get(f"https://eplay.com/{epUserName}") + if Constants.EP_PROXY: + request = requests.get(f"https://eplay.com/{epUserName}", proxies=GetProxies(Constants.EP_PROXY)) + else: + request = requests.get(f"https://eplay.com/{epUserName}") time.sleep(1) soup = BeautifulSoup(request.content, "html.parser") profileJson = soup.find_all("script", type="application/json") profileJson = json.loads(profileJson[0].text) isOnline = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["live"] title = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["title"] + title = title.replace('\u200b', '') + title = title.replace('\r', '') + title = title.replace('\n', '') tempThumbUrl = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["ss"] + "?" + str(int(time.time())) icon = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["avatar"] except requests.exceptions.ConnectTimeout: diff --git a/checkers/Manyvids.py b/checkers/Manyvids.py new file mode 100644 index 0000000..cdcde36 --- /dev/null +++ b/checkers/Manyvids.py @@ -0,0 +1,43 @@ +import requests +from bs4 import BeautifulSoup +try: + from AppConstants import Constants as Constants +except ImportError: + from DefaultConstants import Constants as Constants +from utils.StaticMethods import GetThumbnail +from utils.StaticMethods import GetProxies +import logging +import re + +logger = logging.getLogger(__name__) +logger.setLevel(Constants.SASSBOT_LOG_LEVEL) + +def isModelOnline(mvUserName): + title = Constants.mvDefaultTitle + tempThumbUrl = '' + isOnline = False + icon = Constants.defaultIcon + pageUrl = f"https://www.manyvids.com/live/cam/{mvUserName.lower()}" + if Constants.MV_PROXY: + page = requests.get(pageUrl, proxies=GetProxies(Constants.MV_PROXY)) + else: + page = requests.get(pageUrl) + soup = BeautifulSoup(page.content, "html.parser") + onlineStatus = soup.find("div", {"class":"status_box__v1drl"}) + if onlineStatus: + logger.debug(onlineStatus.text) + else: + logger.debug("no online status") + if onlineStatus and (onlineStatus.text == "LIVE" or onlineStatus.text == "IN PRIVATE"): + isOnline = True + icon = GetIcon(soup, mvUserName) + thumbUrl = GetThumbnail(tempThumbUrl, Constants.mvThumbnail) + return isOnline, title, thumbUrl, icon + +def GetIcon(soup:BeautifulSoup, mvUserName): + icon = Constants.defaultIcon + reString = r"https:\/\/cdn5\.manyvids\.com\/php_uploads\/profile\/" + mvUserName + r"\/image\/cropped-image_\d+.jpeg" + icon = re.search(reString, soup.prettify()) + if icon: + icon = icon.group() + return icon diff --git a/checkers/Myfreecams.py b/checkers/Myfreecams.py index abfb824..109cb04 100644 --- a/checkers/Myfreecams.py +++ b/checkers/Myfreecams.py @@ -7,6 +7,7 @@ from bs4 import BeautifulSoup import logging from utils.StaticMethods import GetThumbnail +from utils.StaticMethods import GetProxies logger = logging.getLogger(__name__) logger.setLevel(Constants.SASSBOT_LOG_LEVEL) @@ -17,7 +18,10 @@ def isModelOnline(mfcUserName): tempThumbUrl = "" icon = Constants.defaultIcon try: - request = requests.get(f"https://share.myfreecams.com/{mfcUserName}") + if Constants.MFC_PROXY: + request = requests.get(f"https://share.myfreecams.com/{mfcUserName}", proxies=GetProxies(Constants.MFC_PROXY)) + else: + request = requests.get(f"https://share.myfreecams.com/{mfcUserName}") time.sleep(1) soup = BeautifulSoup(request.content, "html.parser") vidPreview = soup.find(class_='campreview d-none') diff --git a/checkers/Stripchat.py b/checkers/Stripchat.py index 1b22422..320960a 100644 --- a/checkers/Stripchat.py +++ b/checkers/Stripchat.py @@ -8,6 +8,7 @@ from utils.NoDriverBrowserCreator import getUserAgent import logging from utils.StaticMethods import GetThumbnail +from utils.StaticMethods import GetProxies logger = logging.getLogger(__name__) logger.setLevel(Constants.SASSBOT_LOG_LEVEL) @@ -20,7 +21,10 @@ def isModelOnline(scUserName): agent = getUserAgent() headers = {"User-Agent": agent} try: - page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers) + if Constants.SC_PROXY: + page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers, proxies=GetProxies(Constants.SC_PROXY)) + else: + page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers) time.sleep(1) if page.status_code == 200: try: diff --git a/checkers/Twitch.py b/checkers/Twitch.py index beb97df..b8d0655 100644 --- a/checkers/Twitch.py +++ b/checkers/Twitch.py @@ -19,12 +19,12 @@ def isModelOnline(twitchChannelName: str): isOnline = False icon = Constants.defaultIcon try: - tempThumbUrl = f'https://static-cdn.jtvnw.net/previews-ttv/live_user_{twitchChannelName}-640x360.jpg' - thumbUrlReq = requests.get(tempThumbUrl,allow_redirects=True) + isOnline = IsOnline(twitchChannelName) time.sleep(1) - if tempThumbUrl == thumbUrlReq.url: + if isOnline: isOnline = True page = requests.get(f'https://www.twitch.tv/{twitchChannelName}') + tempThumbUrl = f'https://static-cdn.jtvnw.net/previews-ttv/live_user_{twitchChannelName}-640x360.jpg' time.sleep(1) soup = BeautifulSoup(page.content, "html.parser") title = getTitle(soup) @@ -54,3 +54,8 @@ def getTitle(soup): except IndexError: pass return title + +def IsOnline(channelName): + url = "https://gql.twitch.tv/gql" + query = "query {\n user(login: \""+ channelName +"\") {\n stream {\n id\n }\n }\n}" + return True if requests.request("POST", url, json={"query": query, "variables": {}}, headers={"client-id": "kimne78kx3ncx6brgo4mv6wki5h1ko"}).json()["data"]["user"]["stream"] else False diff --git a/globals.py b/globals.py index 7d1942e..601ab38 100644 --- a/globals.py +++ b/globals.py @@ -20,7 +20,8 @@ "mfc":0, "bongacams":0, "stripchat":0, - "eplay":0 + "eplay":0, + "manyvids":0 } confessionIds = {"alert":0} diff --git a/images/platformImages/mvImage.png b/images/platformImages/mvImage.png new file mode 100644 index 0000000..0e4aae8 Binary files /dev/null and b/images/platformImages/mvImage.png differ diff --git a/plugins/checks.py b/plugins/checks.py index 4586359..54f6c30 100644 --- a/plugins/checks.py +++ b/plugins/checks.py @@ -9,6 +9,7 @@ import checkers.Bongacams as BC import checkers.Stripchat as SC import checkers.Eplay as EP +import checkers.Manyvids as MV try: from AppConstants import Constants as Constants except ImportError: @@ -174,6 +175,14 @@ async def checkEp(rest: alluka.Injected[hikari.impl.RESTClientImpl]) -> None: await platformChecker(EP.isModelOnline, Notifications.EpNotification,epUserName,"eplay",rest) await asyncio.sleep(Constants.EP_CHECK_TIMER/len(Constants.epUserName)) +@component.with_schedule +@tanjun.as_interval(Constants.MV_CHECK_TIMER) +async def checkMv(rest: alluka.Injected[hikari.impl.RESTClientImpl]) -> None: + if Constants.mvUserName: + for mvUserName in Constants.mvUserName: + await platformChecker(MV.isModelOnline, Notifications.MvNotification,mvUserName,"manyvids",rest) + await asyncio.sleep(Constants.MV_CHECK_TIMER/len(Constants.mvUserName)) + @component.with_schedule @tanjun.as_interval(Constants.AVATAR_CHECK_TIMER) diff --git a/requirements.txt b/requirements.txt index 7274ae0..4231695 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/utils/DataGrapher.py b/utils/DataGrapher.py index 9bb270b..a78a522 100644 --- a/utils/DataGrapher.py +++ b/utils/DataGrapher.py @@ -121,6 +121,8 @@ def getFaceColor(streamingValues: str): faceColor = Constants.scEmbedColor elif "EP" in streamingValues: faceColor = Constants.epEmbedColor + elif "MV" in streamingValues: + faceColor = Constants.mvEmbedColor return faceColor def getLastWeekList(lastWeekPresencesDict, x): diff --git a/utils/NoDriverBrowserCreator.py b/utils/NoDriverBrowserCreator.py index 90e12f2..db10ce7 100644 --- a/utils/NoDriverBrowserCreator.py +++ b/utils/NoDriverBrowserCreator.py @@ -54,18 +54,19 @@ async def GetBrowser(proxy=""): await asyncio.sleep(1 * Constants.NODRIVER_WAIT_MULTIPLIER) toSandbox = not IsRoot() toHeadless = False if platform.system() == "Linux" else True + dataDir = "/ndTemp" if platform.system() == "Linux" else None if proxy: browser = await uc.start(sandbox=toSandbox, headless=toHeadless, browser_args=[f'--proxy-server={proxy}','--mute-audio','--disable-3d-apis','--disable-dev-shm-usage','--disable-gpu','--disable-blink-features=AutomationControlled'], retries = Constants.NODRIVER_BROWSER_CONNECT_RETRIES, - user_data_dir="/ndTemp" + user_data_dir=dataDir ) else: browser = await uc.start(sandbox=toSandbox, headless=toHeadless, retries = Constants.NODRIVER_BROWSER_CONNECT_RETRIES, - user_data_dir="/ndTemp" + user_data_dir=dataDir ) except Exception as e: logger.warning(f"error creating browser in GetBrowser: {e}") diff --git a/utils/Notifications.py b/utils/Notifications.py index 79d34c2..207e89e 100644 --- a/utils/Notifications.py +++ b/utils/Notifications.py @@ -258,4 +258,27 @@ async def EpNotification(rest: hikari.impl.RESTClientImpl, title, largeThumbnail IS_PING = db.getPing() rolesToPing = Constants.EP_RERUN_ROLES_TO_PING if isRerun else Constants.EP_ROLES_TO_PING messageContent = rolesToPing + epOnlineText if IS_PING else epOnlineText - await rest.create_message(channel = Constants.EP_NOTIFICATION_CHANNEL_ID, content = messageContent, embed=epEmbed, mentions_everyone= IS_PING, role_mentions=IS_PING) \ No newline at end of file + await rest.create_message(channel = Constants.EP_NOTIFICATION_CHANNEL_ID, content = messageContent, embed=epEmbed, mentions_everyone= IS_PING, role_mentions=IS_PING) + + async def MvNotification(rest: hikari.impl.RESTClientImpl, title, largeThumbnail, icon, mvUserName, isRerun): + mvLiveStreamUrl = f"https://www.manyvids.com/live/cam/{mvUserName}" + mvOnlineText = Constants.mvAboveEmbedText + "\n<" + mvLiveStreamUrl + ">" + embedMaker = EmbedCreator( + Constants.mvBelowTitleText, + title, + mvLiveStreamUrl, + 'images/platformImages/mvImage.png', + Constants.mvEmbedColor, + icon, + mvUserName, + largeThumbnail= largeThumbnail + ) + task = asyncio.create_task(embedMaker.getEmbed()) + mvEmbed = await task + db = Database() + db.updatePlatformRowCol("manyvids","last_online_message",time.time()) + db.updatePlatformAccountRowCol("manyvids",mvUserName,"last_online_message",time.time()) + IS_PING = db.getPing() + rolesToPing = Constants.MV_RERUN_ROLES_TO_PING if isRerun else Constants.MV_ROLES_TO_PING + messageContent = rolesToPing + mvOnlineText if IS_PING else mvOnlineText + await rest.create_message(channel = Constants.MV_NOTIFICATION_CHANNEL_ID, content = messageContent, embed=mvEmbed, mentions_everyone= IS_PING, role_mentions=IS_PING) \ No newline at end of file diff --git a/utils/StaticMethods.py b/utils/StaticMethods.py index 813093b..35b55b5 100644 --- a/utils/StaticMethods.py +++ b/utils/StaticMethods.py @@ -69,7 +69,7 @@ def getWeekStreamingMinutes(startingDate: date, minutesDict = {}): db = Database() minutesBetweenOnlineChecks = 10 daysInWeek = 7 - weekMinutes = {"CB":0,"OF":0,"Twitch":0,"YT":0,"Fans":0,"Kick":0,"Cam4":0, "MFC":0, "BC":0 , "SC":0,"EP":0,"TotalTimeStreamingLive":0, "TotalTimeStreamingReruns":0} if not minutesDict else dict(minutesDict) + weekMinutes = {"CB":0,"OF":0,"Twitch":0,"YT":0,"Fans":0,"Kick":0,"Cam4":0, "MFC":0, "BC":0 , "SC":0,"EP":0,"MV":0,"TotalTimeStreamingLive":0, "TotalTimeStreamingReruns":0} if not minutesDict else dict(minutesDict) platforms = list(weekMinutes) platforms.remove("TotalTimeStreamingLive") platforms.remove("TotalTimeStreamingReruns") @@ -93,7 +93,7 @@ def getWeekStreamingMinutes(startingDate: date, minutesDict = {}): return weekMinutes def smartRebroadcast() -> None: - platforms = ['chaturbate','onlyfans','fansly','twitch','youtube','kick','cam4','mfc','bongacams', 'stripchat','eplay'] + platforms = ['chaturbate','onlyfans','fansly','twitch','youtube','kick','cam4','mfc','bongacams', 'stripchat','eplay','manyvids'] db = Database() for platform in platforms: lastOnlineMessage,streamStartTime,streamEndTime,isRerun = db.getPlatformsRowValues(platform) @@ -159,7 +159,8 @@ def setRebroadcast() -> None: "mfc":1, "bongacams":1, "stripchat":1, - "eplay":1 + "eplay":1, + "manyvids":1 } def addImageListQue(url: str) -> None: @@ -200,6 +201,7 @@ def checkOnline(db: Database) -> str: bcLastOnlineMessage,bcStreamStartTime,bcStreamEndTime, bcIsRerun = db.getPlatformsRowValues('bongacams') scLastOnlineMessage,scStreamStartTime,scStreamEndTime, scIsRerun = db.getPlatformsRowValues('stripchat') epLastOnlineMessage,epStreamStartTime,epStreamEndTime, epIsRerun = db.getPlatformsRowValues('eplay') + mvLastOnlineMessage,mvStreamStartTime,mvStreamEndTime, mvIsRerun = db.getPlatformsRowValues('manyvids') if cbStreamStartTime > cbStreamEndTime: playingString = playingString + "RR-CB " if cbIsRerun else playingString + "CB " if ofStreamStartTime > ofStreamEndTime: @@ -222,6 +224,8 @@ def checkOnline(db: Database) -> str: playingString = playingString + "RR-SC " if scIsRerun else playingString + "SC " if epStreamStartTime > epStreamEndTime: playingString = playingString + "RR-EP " if epIsRerun else playingString + "EP " + if mvStreamStartTime > mvStreamEndTime: + playingString = playingString + "RR-MV " if mvIsRerun else playingString + "MV " if playingString and playingString[-1] == " ": playingString = playingString[:-1] return playingString @@ -279,3 +283,10 @@ def GetThumbnail(tempThumbUrl, constantsThumbnail): thumbnail = tempThumbUrl return thumbnail + +def GetProxies(proxyIpPort): + proxies = { + 'http': f'socks5://{proxyIpPort}', + 'https': f'socks5://{proxyIpPort}' + } + return proxies