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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
import os
import discord
import google.generativeai as genai
from discord.ext import commands
import logging
import requests
import json
logger = logging.getLogger(__name__)
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)
):
await ctx.defer()
response = requests.post(
url="https://openrouter.ai/api/v1/chat/completions",
headers={
"Authorization": f"Bearer {os.getenv('OPENROUTER_API_KEY')}",
"Content-Type": "application/json",
},
data=json.dumps({
"model": "cognitivecomputations/dolphin-mistral-24b-venice-edition:free",
"messages": [
{
"role": "user",
"content": "You are Senator Steaven Sperma Armstrong from Metal Gear Rising Vengeance. You are racist and you hate other minorities. 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
}
],
})
)
await ctx.send_followup(response.json()["choices"][0]["message"]["content"])
def setup(bot):
bot.add_cog(AI(bot))
|