Start of Armia Hammera

This commit is contained in:
2024-11-15 11:10:49 +01:00
parent 06192c41ad
commit 8429d4efd5
+41 -7
View File
@@ -2,13 +2,16 @@
import logging import logging
import re import re
import sys import sys
import Enum
from datetime import datetime from datetime import datetime
from typing import Optional
import discord import discord
import openai import openai
import requests import requests
from discord.ext import commands from discord.ext import commands
import ai_functions import ai_functions
from constants import ( from constants import (
ASSISTANTS, ASSISTANTS,
@@ -20,7 +23,13 @@ from constants import (
SPECJALNE_ZIEMNIACZKI, SPECJALNE_ZIEMNIACZKI,
WORD_REACTIONS, WORD_REACTIONS,
) )
DM_MODE = "assistant" class Dm_Mode(Enum):
ARMIA_HAMMER = 1,
SPECJALNY_ZIEMNIACZEK = 2,
SEKRETNY_SEKSRET = 3
class Events(commands.Cog): class Events(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot = bot self.bot = bot
@@ -59,12 +68,39 @@ class Events(commands.Cog):
description="Jeśli nie wiesz jak użyć tej komendy to nawet nie próbuj", description="Jeśli nie wiesz jak użyć tej komendy to nawet nie próbuj",
guild=discord.Object(id=664789470779932693), guild=discord.Object(id=664789470779932693),
) )
async def switch_dm_mode(self, ctx): async def switch_dm_mode(self, ctx, arg: Dm_Mode):
if isinstance(ctx.channel, discord.DMChannel):
pass # add in on message
# broadcast avaiable only for me
with ctx.typing:
if isinstance(ctx.channel, discord.DMChannel):
for superfryta in SPECJALNE_ZIEMNIACZKI.values():
if ctx.message.author.id == superfryta[0]:
await ctx.reply("Weszlo")
return
await ctx.reply("Tylko członkowie Armii Hammera mogą używać. Nie jesteś jednym z nich")
else:
await ctx.reply("Nope. Nie wiesz jak użyć")
#secrets, assistant, echo, dm #secrets, assistant, echo, dm
#required parameter from list of values - assistant, dm_broadcast, echo #required parameter from list of values - assistant, dm_broadcast, echo
@commands.hybrid_command(
name="armia_hammera",
description="Jeśli nie wiesz jak użyć tej komendy to nawet nie próbuj",
guild=discord.Object(id=664789470779932693),
)
async def armia_hammera(self, ctx, message_txt: str, recipient: Optional[int]):
pass
async def armia_hammera_back():
#user = await self.bot.fetch_user(703985955312238664)
#channel = await user.create_dm()
#await channel.send(message.content)
#await message.reply(f"Poszlo do Saint {message.content}")
pass
@commands.Cog.listener() @commands.Cog.listener()
async def on_message(self, message): async def on_message(self, message):
""" """
@@ -109,11 +145,9 @@ class Events(commands.Cog):
await ai_functions.chat_with_assistant(message, superfryta[1]) await ai_functions.chat_with_assistant(message, superfryta[1])
return return
channel = self.bot.get_channel(1064888712565100614) channel = self.bot.get_channel(1064888712565100614)
#await channel.send("Słyszałem ja żem że: " + message.content) await channel.send("Słyszałem ja żem że: " + message.content)
return return
channel = message.channel channel = message.channel
# await self.bot.process_commands(message) #uncomment to bilocate
message.content = message.content.lower() message.content = message.content.lower()
tdelta = datetime.now() - MASTER_TIMEOUT tdelta = datetime.now() - MASTER_TIMEOUT