aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/ai.py
blob: 484776ce2377947a1364f033864952887a5ddad7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import discord
from discord.ext import commands
import google.generativeai as genai
import os

class AI(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.slash_command(
        name="senator",
        description="SEENATOR",
    )
    async def senator(
        self,
        ctx: discord.ApplicationContext,
        text = discord.Option(str, "message", required=True)
    ):
        '''
        OOWA this so impressive gwachan >w<
        I can't believe you made this you are so good gwachan :3
        '''
        await ctx.defer()
        genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
        model = genai.GenerativeModel("gemini-1.5-flash")
        response = model.generate_content(
            "You are Senator Armstrong from Metal Gear Rising Vengeance. Respond in plain text, no ** or "". If the message is in Polish, respond in Polish. Respond accordingly to this message: "+text,
            generation_config=genai.types.GenerationConfig(
                max_output_tokens=100
            )
        )
        await ctx.respond(response.text)

def setup(bot):
    bot.add_cog(AI(bot))