ausboss / PygDiscordBot

Discord bot that uses KoboldAI. Supports tavern cards and json files.
63 stars 29 forks source link

PR #31

Open Anonym0us33 opened 1 year ago

Anonym0us33 commented 1 year ago

i tried to make a PR but i got an error Pull request creation failed. Validation failed: must be a collaborator

        if "https://giphy.com/gifs/" in message_content:
            # Extract the giphy GIF URL from the message content
            start_index = message_content.index("https://giphy.com/gifs/")
            end_index = message_content.find(" ", start_index)
            if end_index == -1:
                tenor_url = message_content[start_index:]
            else:
                tenor_url = message_content[start_index:end_index]
            # Split the URL on forward slashes
            parts = tenor_url.split("/")
            # Extract the relevant words from the URL
            words = parts[-1].split("-")[:-1]
            # Join the words into a sentence
            sentence = " ".join(words)
            message_content = f"{message_content} [{message.author.name} posts an animated {sentence} ]"
            message_content = message_content.replace(tenor_url, "")
            return message_content
 giphy_pattern = re.compile(r'https://giphy.com/gifs/[\w-]+')

        elif giphy_pattern.search(message.content):
            return True

i lost my formatting and explanation of the code that I typed out because of the permission error so here you go.

ausboss commented 1 year ago

So what exactly is this doing? Does it replace the existing one for tenor.com/view or is to be used in conjunction with it in like an if/else statement?