diff options
Diffstat (limited to '')
| -rw-r--r-- | cogs/ai.py | 20 |
1 files changed, 11 insertions, 9 deletions
| @@ -1,7 +1,9 @@ | |||
| 1 | import os | ||
| 2 | |||
| 1 | import discord | 3 | import discord |
| 2 | from discord.ext import commands | ||
| 3 | import google.generativeai as genai | 4 | import google.generativeai as genai |
| 4 | import os | 5 | from discord.ext import commands |
| 6 | |||
| 5 | 7 | ||
| 6 | class AI(commands.Cog): | 8 | class AI(commands.Cog): |
| 7 | def __init__(self, bot): | 9 | def __init__(self, bot): |
| @@ -12,22 +14,22 @@ class AI(commands.Cog): | |||
| 12 | description="SEENATOR", | 14 | description="SEENATOR", |
| 13 | ) | 15 | ) |
| 14 | async def senator( | 16 | async def senator( |
| 15 | self, | 17 | self, |
| 16 | ctx: discord.ApplicationContext, | 18 | ctx: discord.ApplicationContext, |
| 17 | text = discord.Option(str, "message", required=True) | 19 | text=discord.Option(str, "message", required=True) |
| 18 | ): | 20 | ): |
| 19 | ''' | 21 | """ |
| 20 | OOWA this so impressive gwachan >w< | 22 | OOWA this so impressive gwachan >w< |
| 21 | I can't believe you made this you are so good gwachan :3 | 23 | I can't believe you made this you are so good gwachan :3 |
| 22 | ''' | 24 | """ |
| 23 | await ctx.defer() | 25 | await ctx.defer() |
| 24 | genai.configure(api_key=os.getenv("GOOGLE_API_KEY")) | 26 | genai.configure(api_key=os.getenv("GOOGLE_API_KEY")) |
| 25 | model = genai.GenerativeModel("gemini-1.5-flash") | 27 | model = genai.GenerativeModel("gemini-1.5-flash") |
| 26 | response = model.generate_content( | 28 | response = model.generate_content( |
| 27 | "You are Senator Steaven Sperma Armstrong from Metal Gear Rising Vengeance. Respond in plain text, no ** or "". If the message is in Polish, respond in Polish. Respond in 100 words. Respond accordingly to this message: "+text, | 29 | "You are Senator Steaven Sperma Armstrong from Metal Gear Rising Vengeance. Respond in plain text, no ** or "". If the message is in Polish, respond in Polish. Respond in 100 words. Respond accordingly to this message: " + text, |
| 28 | ) | 30 | ) |
| 29 | await ctx.respond(response.text) | 31 | await ctx.respond(response.text) |
| 30 | 32 | ||
| 33 | |||
| 31 | def setup(bot): | 34 | def setup(bot): |
| 32 | bot.add_cog(AI(bot)) | 35 | bot.add_cog(AI(bot)) |
| 33 | \ No newline at end of file | ||
