I have implemented a Bot that integrates OpenAIs API with a simple TwitchIO Chatbot as one of my first ever python projects.
However I am stuck on implementing a type of "Filter" for different kinds of users. I don´t want everyone to spend my api credits. How would I do that efficiently? I have tried to read the Documentation but can´t really wrap my head around the subroutines and required arguments.

this is the part of the code that needs a filter.

    # COMMAND: Question to GPT
    async def event_message(self, message):
        # Check if the message was sent by the bot...
        if message.echo:
            return
        else:
            # Check if the message starts with our prefix and Command
            if message.content.startswith(PREFIX + KOMMANDO):
                    await message.channel.send('@'+message.author.name+" "+THINK)
                    await message.channel.send('@' + message.author.name + " " + ask_GPT(message.content[len(PREFIX + KOMMANDO):]))

0

There are 0 best solutions below