From 8429d4efd524c78983317407403bd7ed7480a98b Mon Sep 17 00:00:00 2001 From: mtuszowski Date: Fri, 15 Nov 2024 11:10:49 +0100 Subject: [PATCH] Start of Armia Hammera --- ai_commands.py | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/ai_commands.py b/ai_commands.py index 6ae44c8..3b78d44 100644 --- a/ai_commands.py +++ b/ai_commands.py @@ -2,13 +2,16 @@ import logging import re import sys +import Enum from datetime import datetime +from typing import Optional import discord import openai import requests from discord.ext import commands + import ai_functions from constants import ( ASSISTANTS, @@ -20,7 +23,13 @@ from constants import ( SPECJALNE_ZIEMNIACZKI, WORD_REACTIONS, ) -DM_MODE = "assistant" +class Dm_Mode(Enum): + ARMIA_HAMMER = 1, + SPECJALNY_ZIEMNIACZEK = 2, + SEKRETNY_SEKSRET = 3 + + + class Events(commands.Cog): def __init__(self, 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", guild=discord.Object(id=664789470779932693), ) - async def switch_dm_mode(self, ctx): - if isinstance(ctx.channel, discord.DMChannel): - pass + async def switch_dm_mode(self, ctx, arg: Dm_Mode): + + # 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 #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() async def on_message(self, message): """ @@ -109,11 +145,9 @@ class Events(commands.Cog): await ai_functions.chat_with_assistant(message, superfryta[1]) return 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 channel = message.channel - # await self.bot.process_commands(message) #uncomment to bilocate - message.content = message.content.lower() tdelta = datetime.now() - MASTER_TIMEOUT