def update(self):
        if not self.callable:
            return
        self.callable = False
        discord_rpc.update_presence(
            **{
                'state': 'DiamondsBattle',
                'details': self.details,
                'start_timestamp': self.start,
                'end_timestamp': self.start + 1000,
                'large_image_key': self.large_image,
                'large_image_text': self.large_image_text,
                'small_image_key': self.small_image,
                'small_image_text': self.small_image_text,
                'party_id': self.party_id,
                'party_size': self.party_size,
                'secrets_join': self.secrets_join,
                'secrets_spectate': self.secrets_spectate,
                'secrets_match': self.secrets_match,
            })

        discord_rpc.update_connection()
        invoke(discord_rpc.run_callbacks, delay=2)
        invoke(setattr, self, 'callable', True, delay=2)
Beispiel #2
0
    callbacks = {
        'ready': readyCallback,
        'disconnected': disconnectedCallback,
        'error': errorCallback,
    }
    discord_rpc.initialize('762165532384165889', callbacks=callbacks, log=False)

    i = 0
    start = time.time()
    while i < 10:
        i += 1

        discord_rpc.update_presence(
            **{
                'details': 'Sniping Minecraft Names',
                'start_timestamp': start,
                'large_image_key': 'mcsniperpy'
            }
        )

        discord_rpc.update_connection()
        time.sleep(2)
        discord_rpc.run_callbacks()

def custom_info(message):
    logging.info(f"{Fore.BLUE}[info] {Fore.RESET}{message}")


def print_title():
    print(f"""
Beispiel #3
0
    def do_POST(self):
        discord_rpc.initialize('386747342080049168',
                               callbacks=callbacks,
                               log=False)
        content_length = int(self.headers['Content-Length'])
        post_data = self.rfile.read(content_length)
        logging.info("Body:\n%s\n", post_data.decode('utf-8'))
        self._set_response()
        self.wfile.write("POST request for {}".format(
            self.path).encode('utf-8'))
        parsedurl = urlparse(json.loads(post_data.decode('utf-8'))['url'],
                             allow_fragments=False)
        if parsedurl.netloc == 'hololive.jetri.co' and parsedurl.query != "":
            with urllib.request.urlopen(
                    "https://www.googleapis.com/youtube/v3/videos?part=snippet&fields=items(snippet(channelTitle,channelId))&id="
                    + parsedurl.query.split('=')[1] +
                    "&key=yourgoogleapikey") as url:
                data = json.loads(url.read().decode())
                global firstconn
                names = []
                if len(data['items']) != 0:
                    for x in range(len(data['items'])):
                        with open('list.json') as f:
                            name = json.load(f)

                            def doname():
                                i = 0
                                while i <= len(name) + 1:
                                    if i == len(name):
                                        return 404
                                    if name[i]['channel_id'] == data['items'][
                                            x]['snippet']['channelId']:
                                        names.append(name[i]['channel_name'])
                                        return 0
                                    i += 1

                            if doname() == 404:
                                names.append(data['items'][x]['snippet']
                                             ['channelTitle'])
                        stream = ' stream' if len(
                            data['items']) == 1 else ' streams'
                    if len(names) < 3:
                        namess = " and ".join(names[:+len(names)])
                    else:
                        namess = ", ".join(
                            names[:+len(names) - 2]) + ", " + " and ".join(
                                names[-2:])
                    if firstconn == 1:
                        for a in range(0, 3):
                            discord_rpc.update_presence(
                                **{
                                    'details': "Watching " + namess + stream,
                                    'start_timestamp': time.time()
                                })

                            discord_rpc.update_connection()
                            time.sleep(2)
                            discord_rpc.run_callbacks()
                            firstconn = 0
                    else:
                        discord_rpc.update_presence(
                            **{
                                'details': "Watching " + namess + stream,
                                'start_timestamp': time.time()
                            })

                        discord_rpc.update_connection()
                        time.sleep(2)
                        discord_rpc.run_callbacks()
                del names
        else:
            firstconn = 1
            discord_rpc.shutdown()
Beispiel #4
0
    def baixar(self, progress_callback):
        self.getTextString = self.textbox.text()
        self.getTextValue = int(self.getTextString)

        #Notificação de aviso
        if self.notification.isChecked() == False:
            notificationComplete = Notify(
                default_notification_application_name="HentaiDownloader",
                default_notification_title="Aviso",
                default_notification_message="Avisaremos Por aqui quando baixarmos tudo :D (QUANDO TUDO ACABAR IRÁ SAIR UM GEMIDINHO )",
                default_notification_icon=icon
                )

            notificationComplete.send()

        for i in range(self.getTextValue):
            #progress_callback.emit(i*100/getTextValue)

            IDran = random.randrange(1, 111767)
            link = "{}".format(IDran)

            self.baixados.setText("Imagens Baixadas: %d" % i)

            #Discord init RichPresence
            if self.RichPresence.isChecked() == False:
                discord_rpc.initialize('816485448666578984', callbacks=callbacks, log=False)
                discord_rpc.update_presence(
                    **{
                        'details': 'Baixando Hentai ID: {}'.format(IDran),
                        'state': 'Baixei {} Hentais 😎🤙'.format(i),
                        'start_timestamp': start,
                        ''
                        'large_image_key': 'android-chrome-512x512'
                    }
                )

            discord_rpc.update_connection()
            discord_rpc.run_callbacks()
            
            #JPEG/JPG
            linkJPEG = "https://figure.superhentais.com/img/figure/{}{}.download".format(IDran, formatJPEG)
            URLdirJPEG = requests.get(linkJPEG)
            verifyJPEG = self.get_content_type(linkJPEG)
            #PNG
            linkPNG = "https://figure.superhentais.com/img/figure/{}{}.download".format(IDran, formatPNG)
            URLdirPNG = requests.get(linkPNG)
            verifyPNG = self.get_content_type(linkPNG)
            #GIF
            linkGIF = "https://figure.superhentais.com/img/figure/{}{}.download".format(IDran, formatGIF)
            URLdirGIF = requests.get(linkGIF)
            verifyGIF = self.get_content_type(linkGIF)
            ###########
            ###########
            print("ID: " + link)
            
            #Se a imagem for JPEG
            print(verifyJPEG)
            if verifyJPEG == "image/jpeg":
                print(linkJPEG)
                ImageJPEGname = "Super-Hentai-Image-{}{}".format(IDran, formatJPEG)
                file = open(f"{ImagePath}{ImageJPEGname}", "wb")
                file.write(URLdirJPEG.content)
                file.close()

                imgQuality = Image.open(f"{ImagePath}{ImageJPEGname}")
                imgQuality.save(f"{ImagePath}{ImageJPEGname}", quality=100)

                #Preview Image
                if self.imagePreview.isChecked() == False:

                    self.HentaiView = QtGui.QPixmap(f"{ImagePath}{ImageJPEGname}")
                    scaledpreiew = self.HentaiView.scaled(400,400, QtCore.Qt.KeepAspectRatio)
                    self.hentaiv.setPixmap(scaledpreiew)

            #Se a imagem for PNG
            print(verifyPNG)
            if verifyPNG == "image/png":
                print(linkPNG)
                ImagePNGname = "Super-Hentai-Image-{}{}".format(IDran, formatPNG)
                file = open(f"{ImagePath}{ImagePNGname}", "wb")
                file.write(URLdirPNG.content)
                file.close()

                #Preview Image
                if self.imagePreview.isChecked() == False:

                    self.HentaiView = QtGui.QPixmap(f"{ImagePath}{ImagePNGname}")
                    scaledpreiew = self.HentaiView.scaled(400,400, QtCore.Qt.KeepAspectRatio)
                    self.hentaiv.setPixmap(scaledpreiew)

            #Verificar se é gif
            print(verifyGIF)
            if verifyGIF == "image/gif":
                print(linkGIF)
                ImageGIFname = "Super-Hentai-Image-{}{}".format(IDran, formatGIF)
                file = open(f"{GifPath}{ImageGIFname}", "wb")
                file.write(URLdirGIF.content)
                file.close()
                
                #Preview Image
                if self.imagePreview.isChecked() == False:

                    self.HentaiView = QtGui.QPixmap(f"{GifPath}{ImageGIFname}")
                    scaledpreiew = self.HentaiView.scaled(400,400, QtCore.Qt.KeepAspectRatio)
                    self.hentaiv.setPixmap(scaledpreiew)
            
            self.setWindowTitle("{}: {}".format(AppName,IDran))
            print("=-"*40)
            
        #Notificação de downloa completo
        if self.notification.isChecked() == False:
            notificationComplete = Notify(
                default_notification_application_name="HentaiDownloader",
                default_notification_title="Aviso Download",
                default_notification_message="Hentais Baixados {}".format(i + 1),
                default_notification_icon=icon,
                default_notification_audio=completenotificationAudio
                )
            notificationComplete.send()
Beispiel #5
0
def main():
    colorama.init(autoreset=True)

    # Console Logs
    def ready_callback(curr_user):
        user = f'{curr_user["username"]}#{curr_user["discriminator"]} ID: {curr_user["id"]}'
        print(colored(f'Running Rich Presence: {user}', 'cyan'))
        print(
            colored(
                'Спасибо за использование моего Rich Presence! От' + Fore.RED +
                ' bangakek', 'green'))

    def disconnection_callback(codeno, codemsg):
        print(
            colored(
                f'Disconnected from Disocrd. Rich Presence stopped show.\n' +
                Fore.BLUE + f'Code: {codeno}\n{codemsg}', 'red', 'on_yellow'))

    def err_callback(errno, errmsg):
        print(
            colored(f'An error has occured.\nError: {errno}\n{errmsg}', 'red'))

    callbacks = {
        'ready': ready_callback,
        'disconnected': disconnection_callback,
        'error': err_callback
    }

    # Collecting Data from JSON
    with open('RichPresenceData.json', encoding='utf-8') as f:
        data = json.load(f)

    # Initialisation
    rpc.initialize(data['appID'], callbacks=callbacks, log=False)

    # Converting data to presence dict
    presence_data = {'state': data['desc2'], 'details': data['desc1']}
    if data['useTimestamp']:
        presence_data.update({'start_timestamp': time.time()})
    if data['useImages']:
        presence_data.update({
            'large_image_key':
            data['imageData']['largeImage']['key'],
            'large_image_text':
            data['imageData']['largeImage']['text'],
            'small_image_key':
            data['imageData']['smallImage']['key'],
            'small_image_text':
            data['imageData']['smallImage']['text']
        })
    # print(presence_data)
    if data['useParty']:
        presence_data.update({
            'party_id': data['partyInfo']['partyID'],
            'party_size': data['partyInfo']['partySize'],
            'party_max': data['partyInfo']['partyMax']
        })

    # Running Rich Presence
    while True:

        rpc.update_presence(**presence_data)
        rpc.update_connection()
        time.sleep(1)
        rpc.run_callbacks()
Beispiel #6
0
discord_rpc.initialize(client_id,
                       callbacks=callbacks,
                       auto_update_connection=True)
discord_rpc.register_game(client_id, steam_id="739630")

#start watching level files
iNotifier = inotify.adapters.Inotify()
for i in range(9):
    print(
        os.path.join(phasmophobiaDir, 'Phasmophobia_Data', ('level' + str(i))))
    iNotifier.add_watch(os.path.join(phasmophobiaDir, 'Phasmophobia_Data',
                                     ('level' + str(i))),
                        mask=0x00000020)

for event in iNotifier.event_gen():
    if event != None:
        (_, type_names, path, filename) = event
        levelNumber = int(path[-1])
        map = mapNames[levelNumber]

        discord_rpc.update_presence(
            **{
                'state': map,
                'large_image_key': map.lower().replace(' ', '_'),
                'start_timestamp': int(time.time()),
            })
        discord_rpc.run_callbacks()
        time.sleep(20)
    if game.poll() != None:
        discord_rpc.shutdown()
        exit()
    # Note: 'event_name': callback
    callbacks = {
        'ready': readyCallback,
        'disconnected': disconnectedCallback,
        'error': errorCallback,
    }
    discord_rpc.initialize('692341410820653076',
                           callbacks=callbacks,
                           log=False)

    i = 0
    start = time.time()
    while i < 10:
        i += 1

        discord_rpc.update_presence(
            **{
                'details': 'Bot Polyvalent',
                'state': 'Prévention Anti-Raid',
                'start_timestamp': start,
                'large_image_key': 'seven_large',
                'large_image_text': 'Rejoignez-nous dès maintenant !',
                'small_image_key': 'seven',
                'small_image_text': "L'efficacité, notre priorité !"
            })

        discord_rpc.update_connection()
        time.sleep(2)
        discord_rpc.run_callbacks()
    discord_rpc.shutdown()
Beispiel #8
0
 def update(**kwargs):
     discord_rpc.update_presence(**kwargs)
     discord_rpc.update_connection()
     discord_rpc.run_callbacks()