diff options
| author | SamlonDev <stankiewiczgracjan2019@gmail.com> | 2025-06-14 18:54:02 +0200 |
|---|---|---|
| committer | SamlonDev <stankiewiczgracjan2019@gmail.com> | 2025-06-14 18:54:02 +0200 |
| commit | 791e75cb2beeca45a6edf52b65f7e299e03b5eaf (patch) | |
| tree | cfee93211b7f8ac1c985325aaf8d9399b7a357ca /cogs/ai.py | |
| parent | temp downloads the files instead (diff) | |
| download | senator-sperma-791e75cb2beeca45a6edf52b65f7e299e03b5eaf.tar.gz senator-sperma-791e75cb2beeca45a6edf52b65f7e299e03b5eaf.zip | |
code-style issues
Diffstat (limited to 'cogs/ai.py')
| -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 | ||
