import discord
import openai

# Initialize OpenAI API
openai.api_key = 'openai-token'

# Define intents
intents = discord.Intents.all()

class MyClient(discord.Client):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    async def on_ready(self):
        print('Logged on as Intrepid AI')

    async def on_message(self, message):
        # don't respond to ourselves
        if message.author == self.user:
            return

        # Check if the message starts with '+ai'
        if message.content.startswith('+ai'):
            # Remove the '+ai' from the message
            prompt = message.content[3:]

            # Generate a response using OpenAI GPT-3
            response = openai.Completion.create(
              engine="text-davinci-002",
              prompt=prompt,
              max_tokens=100
            )

            await message.channel.send(response.choices[0].text.strip())

        # Check if the message is '+uwu'
        elif message.content == '+uwu':
            await message.channel.send('Hewwo! UwU')

client = MyClient(intents=intents)
client.run('bot-token')


main.py
intrepidbird/intrepidai
import openai

class Uwuifier:
    def __init__(self):
        self.replacements = {
            'r': 'w',
            'l': 'w',
            'R': 'W',
            'L': 'W',
        }

    def uwuify(self, message):
        return "".join(self.replacements.get(c, c) for c in message)

class UwuBot:
    def __init__(self, openai_key):
        self.uwuifier = Uwuifier()
        openai.api_key = openai_key

    def respond(self, message):
        response = openai.Completion.create(
          engine="text-davinci-002",
          prompt=message,
          max_tokens=100
        )
        return self.uwuifier.uwuify(response.choices[0].text.strip())

def main():
    bot = UwuBot('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')
    while True:
        message = input("Enter your message: ")
        if message.lower() == "quit":
            break
        print(bot.respond(message))

if __name__ == "__main__":
    main()

uwu-ai.py
intrepidbird/intrepidai