This commit is contained in:
2024-11-15 14:01:25 +01:00
parent 73057921ec
commit 81c43aadcc
2 changed files with 35 additions and 15 deletions
+9
View File
@@ -32,6 +32,7 @@ class AdministrationModule(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),
) )
@commands.has_any_role('Nocna Zmiana', 'Jarl', 'Thane')
async def galeria_slaw(self, ctx): async def galeria_slaw(self, ctx):
if isinstance(ctx.channel, discord.DMChannel): if isinstance(ctx.channel, discord.DMChannel):
for guild in self.bot.guilds: for guild in self.bot.guilds:
@@ -51,6 +52,8 @@ class AdministrationModule(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),
) )
@commands.has_any_role('Jarl', 'Thane')
async def update_banlist(self, ctx): async def update_banlist(self, ctx):
""" """
Update a banlist in a Discord guild from preprovided list in channel. Update a banlist in a Discord guild from preprovided list in channel.
@@ -135,6 +138,12 @@ class AdministrationModule(commands.Cog):
f"Nie mam na serwerze {guild} uprawnień do banowania. :()" f"Nie mam na serwerze {guild} uprawnień do banowania. :()"
) )
await ctx.send("Zrobione tak czy inaczej") await ctx.send("Zrobione tak czy inaczej")
@commands.hybrid_command(
name="archive_channel",
description="Jeśli nie wiesz jak użyć tej komendy to nawet nie próbuj",
guild=discord.Object(id=664789470779932693),
)
@commands.has_any_role('Jarl', 'Thane')
async def archive_channel(self, channel_no): async def archive_channel(self, channel_no):
""" """
+26 -15
View File
@@ -4,7 +4,7 @@ import re
import sys import sys
from enum import Enum from enum import Enum
from datetime import datetime from datetime import datetime
from typing import Optional from typing import Optional, TypedDict
import discord import discord
import openai import openai
@@ -24,14 +24,18 @@ from constants import (
WORD_REACTIONS, WORD_REACTIONS,
) )
class Dm_Mode(Enum): class Dm_Mode(Enum):
ARMIA_HAMMER = 1, ARMIA_HAMMERA = 1,
SPECJALNY_ZIEMNIACZEK = 2, SPECJALNY_ZIEMNIACZEK = 2,
SEKRETNY_SEKSRET = 3 SEKRETNY_SEKSRET = 3,
ECHO_ECHO = 4
class Events(commands.Cog): class Events(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot = bot self.bot = bot
self.logger = logging.getLogger("discord") self.logger = logging.getLogger("discord")
self.armia = {}
for superfryta in SPECJALNE_ZIEMNIACZKI.values():
self.armia[superfryta[2]] = Dm_Mode.SPECJALNY_ZIEMNIACZEK
async def cog_load(self): async def cog_load(self):
self.logger.info("Starting personal assistants") self.logger.info("Starting personal assistants")
@@ -66,26 +70,21 @@ 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, arg: Dm_Mode): async def switch_dm_mode(self, ctx, dm_mode_arg: Dm_Mode):
async with ctx.typing:
# add in on message
# broadcast avaiable only for me
with ctx.typing:
if isinstance(ctx.channel, discord.DMChannel): if isinstance(ctx.channel, discord.DMChannel):
for superfryta in SPECJALNE_ZIEMNIACZKI.values(): for superfryta in SPECJALNE_ZIEMNIACZKI.values():
if ctx.message.author.id == superfryta[0]: if ctx.message.author.id == superfryta[0]:
self.armia[superfryta[2]] = dm_mode_arg
await ctx.reply("Weszlo") await ctx.reply("Weszlo")
return return
await ctx.reply("Tylko członkowie Armii Hammera mogą używać. Nie jesteś jednym z nich") await ctx.reply("Tylko członkowie Armii Hammera mogą używać. Nie jesteś jednym z nich")
else: else:
await ctx.reply("Nope. Nie wiesz jak użyć") 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( @commands.hybrid_command(
name="armia_hammera", name="armia_hammera",
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),
) )
async def armia_hammera(self, ctx, message_txt: str, recipient: Optional[discord.User]): async def armia_hammera(self, ctx, message_txt: str, recipient: Optional[discord.User]):
pass pass
@@ -139,9 +138,21 @@ class Events(commands.Cog):
for superfryta in SPECJALNE_ZIEMNIACZKI.values(): for superfryta in SPECJALNE_ZIEMNIACZKI.values():
self.logger.info(superfryta[0]) self.logger.info(superfryta[0])
if message.author.id == superfryta[0]: if message.author.id == superfryta[0]:
await self.bot.process_commands(message) if self.armia[message.author.id]== Dm_Mode.SPECJALNY_ZIEMNIACZEK:
await ai_functions.chat_with_assistant(message, superfryta[1]) await self.bot.process_commands(message)
return await ai_functions.chat_with_assistant(message, superfryta[1])
return
elif self.armia[message.author.id]== Dm_Mode.ECHO_ECHO:
await ai_functions.echo(message)
return
elif self.armia[message.author.id]== Dm_Mode.ARMIA_HAMMERA:
#self.armia_hammera_back()
return
elif self.armia[message.author.id]== Dm_Mode.SEKRETNY_SEKSRET:
pass
else:
await message.channel.send("Coś się wyebao. Wołaj Hammera")
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