mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
fx
This commit is contained in:
+39
-20
@@ -31,7 +31,7 @@ class Dm_Mode(Enum):
|
|||||||
ARMIA_HAMMERA = (1,)
|
ARMIA_HAMMERA = (1,)
|
||||||
SPECJALNY_ZIEMNIACZEK = (2,)
|
SPECJALNY_ZIEMNIACZEK = (2,)
|
||||||
SEKRETNY_SEKSRET = (3,)
|
SEKRETNY_SEKSRET = (3,)
|
||||||
ECHO_ECHO = 4
|
ECHO_ECHO = (4,)
|
||||||
|
|
||||||
|
|
||||||
class Events(commands.Cog):
|
class Events(commands.Cog):
|
||||||
@@ -102,7 +102,11 @@ class Events(commands.Cog):
|
|||||||
async def armia_hammera(
|
async def armia_hammera(
|
||||||
self, ctx, message_txt: str, recipient: Optional[discord.User]
|
self, ctx, message_txt: str, recipient: Optional[discord.User]
|
||||||
):
|
):
|
||||||
|
for superfryta in SPECJALNE_ZIEMNIACZKI.values():
|
||||||
|
if ctx.message.author.id == superfryta[0]:
|
||||||
await self.armia_hammera_back(ctx, message_txt, recipient)
|
await self.armia_hammera_back(ctx, message_txt, recipient)
|
||||||
|
return
|
||||||
|
await ctx.reply("Tylko członkowie Armii Hammera mogą używać. Nie jesteś jednym z nich")
|
||||||
|
|
||||||
async def armia_hammera_back(self, ctx, message_txt, recipient=None):
|
async def armia_hammera_back(self, ctx, message_txt, recipient=None):
|
||||||
recipients = []
|
recipients = []
|
||||||
@@ -123,19 +127,35 @@ class Events(commands.Cog):
|
|||||||
|
|
||||||
@commands.Cog.listener(name="dodaj_do_bazy_wiedzy")
|
@commands.Cog.listener(name="dodaj_do_bazy_wiedzy")
|
||||||
async def dodaj_do_bazy_wiedzy(self, ctx):
|
async def dodaj_do_bazy_wiedzy(self, ctx):
|
||||||
pass
|
for superfryta in SPECJALNE_ZIEMNIACZKI.values():
|
||||||
|
if ctx.message.author.id == superfryta[0]:
|
||||||
|
#logic here
|
||||||
|
return
|
||||||
|
await ctx.reply("Tylko członkowie Armii Hammera mogą używać. Nie jesteś jednym z nich")
|
||||||
|
|
||||||
@commands.Cog.listener(name="listuj_baze_wiedzy")
|
@commands.Cog.listener(name="listuj_baze_wiedzy")
|
||||||
async def listuj_baze_wiedzy(self, ctx):
|
async def listuj_baze_wiedzy(self, ctx):
|
||||||
pass
|
for superfryta in SPECJALNE_ZIEMNIACZKI.values():
|
||||||
|
if ctx.message.author.id == superfryta[0]:
|
||||||
|
#logic here
|
||||||
|
return
|
||||||
|
await ctx.reply("Tylko członkowie Armii Hammera mogą używać. Nie jesteś jednym z nich")
|
||||||
|
|
||||||
@commands.Cog.listener(name="usun_z_bazy_wiedzy")
|
@commands.Cog.listener(name="usun_z_bazy_wiedzy")
|
||||||
async def usun_z_bazy_wiedzy(self, ctx):
|
async def usun_z_bazy_wiedzy(self, ctx):
|
||||||
pass
|
for superfryta in SPECJALNE_ZIEMNIACZKI.values():
|
||||||
|
if ctx.message.author.id == superfryta[0]:
|
||||||
|
#logic here
|
||||||
|
return
|
||||||
|
await ctx.reply("Tylko członkowie Armii Hammera mogą używać. Nie jesteś jednym z nich")
|
||||||
|
|
||||||
@commands.Cog.listener(name="przetworz_plik_linia_po_linii")
|
@commands.Cog.listener(name="przetworz_plik_linia_po_linii")
|
||||||
async def przetworz_plik_linia_po_linii(self, ctx):
|
async def przetworz_plik_linia_po_linii(self, ctx):
|
||||||
pass
|
for superfryta in SPECJALNE_ZIEMNIACZKI.values():
|
||||||
|
if ctx.message.author.id == superfryta[0]:
|
||||||
|
#logic here
|
||||||
|
return
|
||||||
|
await ctx.reply("Tylko członkowie Armii Hammera mogą używać. Nie jesteś jednym z nich")
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_message(self, message):
|
async def on_message(self, message):
|
||||||
@@ -196,7 +216,6 @@ class Events(commands.Cog):
|
|||||||
return
|
return
|
||||||
channel = self.bot.get_channel(1064888712565100614)
|
channel = self.bot.get_channel(1064888712565100614)
|
||||||
await discord_friendly_send(channel, "Słyszałem ja żem że: " + message.content)
|
await discord_friendly_send(channel, "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
|
||||||
message.content = message.content.lower()
|
message.content = message.content.lower()
|
||||||
@@ -285,12 +304,12 @@ class Events(commands.Cog):
|
|||||||
)
|
)
|
||||||
except openai.APITimeoutError as e:
|
except openai.APITimeoutError as e:
|
||||||
# Handle timeout error, e.g. retry or log
|
# Handle timeout error, e.g. retry or log
|
||||||
await message.reply(
|
await discord_friendly_reply(
|
||||||
f"*Kondziu patrzy na terminal, czeka, czeka, czeka,.... Jeszcze chwile czeka Przypierdala w niego pięścią....* Nie mogę się połączyć z Openai spróbuj od nowa. *Na ekranie pojawia się*: {e}"
|
message, f"*Kondziu patrzy na terminal, czeka, czeka, czeka,.... Jeszcze chwile czeka Przypierdala w niego pięścią....* Nie mogę się połączyć z Openai spróbuj od nowa. *Na ekranie pojawia się*: {e}"
|
||||||
)
|
)
|
||||||
except openai.APIConnectionError as e:
|
except openai.APIConnectionError as e:
|
||||||
await message.reply(
|
await discord_friendly_reply(
|
||||||
f"*Kondziu patrzy na terminal, chwile się zastanawia. Przypierdala w niego pięścią....* Nie mogę się połączyć z Openai. *Na ekranie pojawia się*: {e}"
|
message, f"*Kondziu patrzy na terminal, chwile się zastanawia. Przypierdala w niego pięścią....* Nie mogę się połączyć z Openai. *Na ekranie pojawia się*: {e}"
|
||||||
)
|
)
|
||||||
except openai.BadRequestError as e:
|
except openai.BadRequestError as e:
|
||||||
# Handle invalid request error, e.g. validate parameters or log
|
# Handle invalid request error, e.g. validate parameters or log
|
||||||
@@ -306,29 +325,29 @@ class Events(commands.Cog):
|
|||||||
username,
|
username,
|
||||||
"RANDOM",
|
"RANDOM",
|
||||||
)
|
)
|
||||||
await message.reply(
|
await discord_friendly_reply(
|
||||||
f"Sorki, cenzura: {resp}. Jak chcesz to są kanały na nudle #sexy-foteczky i #kanal-do-fapania *Na ekranie pojawia się: {e}"
|
message, f"Sorki, cenzura: {resp}. Jak chcesz to są kanały na nudle #sexy-foteczky i #kanal-do-fapania *Na ekranie pojawia się: {e}"
|
||||||
)
|
)
|
||||||
except openai.AuthenticationError as e:
|
except openai.AuthenticationError as e:
|
||||||
# Handle authentication error, e.g. check credentials or log
|
# Handle authentication error, e.g. check credentials or log
|
||||||
await message.reply(
|
await discord_friendly_reply(
|
||||||
f"*Kondziu patrzy na terminal, chwile się zastanawia. Przypierdala w niego pięścią....* Wołaj szefa - coś się z hasłem zjebało. *Na terminalu pojawia się:* {e}"
|
message, f"*Kondziu patrzy na terminal, chwile się zastanawia. Przypierdala w niego pięścią....* Wołaj szefa - coś się z hasłem zjebało. *Na terminalu pojawia się:* {e}"
|
||||||
)
|
)
|
||||||
except openai.PermissionDeniedError as e:
|
except openai.PermissionDeniedError as e:
|
||||||
# Handle permission error, e.g. check scope or log
|
# Handle permission error, e.g. check scope or log
|
||||||
await message.reply(
|
await discord_friendly_reply(
|
||||||
(
|
(
|
||||||
f"*Kondziu patrzy na terminal, chwile się zastanawia. Przypierdala w niego pięścią....* Wołaj szefa - coś się z uprawnieniami zjebało. *Na terminalu pojawia się:* {e}"
|
message, f"*Kondziu patrzy na terminal, chwile się zastanawia. Przypierdala w niego pięścią....* Wołaj szefa - coś się z uprawnieniami zjebało. *Na terminalu pojawia się:* {e}"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
except openai.RateLimitError as e:
|
except openai.RateLimitError as e:
|
||||||
await message.reply(
|
await discord_friendly_reply(
|
||||||
f"*Kondziu patrzy na terminal* Wołaj szefa. Zapłacić rachunki za AI trzeba. Jak chcesz to się na #zebranie dorzuć. {e}"
|
message, f"*Kondziu patrzy na terminal* Wołaj szefa. Zapłacić rachunki za AI trzeba. Jak chcesz to się na #zebranie dorzuć. {e}"
|
||||||
)
|
)
|
||||||
except openai.APIError as e:
|
except openai.APIError as e:
|
||||||
# Handle API error, e.g. retry or log
|
# Handle API error, e.g. retry or log
|
||||||
await message.reply(
|
await discord_friendly_reply(
|
||||||
f"*Kondziu nurkuje za bar, terminal wybucha. Przed tobą ląduje pergamin zapisany pięknym gotykiem a na nim*: {e}"
|
message, f"*Kondziu nurkuje za bar, terminal wybucha. Przed tobą ląduje pergamin zapisany pięknym gotykiem a na nim*: {e}"
|
||||||
)
|
)
|
||||||
if response:
|
if response:
|
||||||
self.logger.info(response)
|
self.logger.info(response)
|
||||||
|
|||||||
+4
-4
@@ -87,20 +87,20 @@ async def get_stats(client, ctx, history_limit):
|
|||||||
|
|
||||||
async def discord_friendly_reply(ctx, message_content, file=None):
|
async def discord_friendly_reply(ctx, message_content, file=None):
|
||||||
if len(message_content) < 999:
|
if len(message_content) < 999:
|
||||||
await ctx.reply(message_content, file)
|
await ctx.reply(message_content)
|
||||||
else:
|
else:
|
||||||
if file:
|
|
||||||
await ctx.reply("Attachment:", file=file)
|
|
||||||
while len(message_content) > 999:
|
while len(message_content) > 999:
|
||||||
await ctx.reply(message_content[:999])
|
await ctx.reply(message_content[:999])
|
||||||
message_content = message_content[999:]
|
message_content = message_content[999:]
|
||||||
|
if file:
|
||||||
|
await ctx.reply("Attachment:", file=file)
|
||||||
|
|
||||||
async def discord_friendly_send(ctx, message_content, file=None):
|
async def discord_friendly_send(ctx, message_content, file=None):
|
||||||
if len(message_content) < 999:
|
if len(message_content) < 999:
|
||||||
await ctx.send(message_content, file)
|
await ctx.send(message_content, file)
|
||||||
else:
|
else:
|
||||||
if file:
|
if file:
|
||||||
await ctx.reply("Attachment:", file=file)
|
await ctx.send("Attachment:", file=file)
|
||||||
while len(message_content) > 999:
|
while len(message_content) > 999:
|
||||||
await ctx.send(message_content[:999])
|
await ctx.send(message_content[:999])
|
||||||
message_content = message_content[999:]
|
message_content = message_content[999:]
|
||||||
|
|||||||
Reference in New Issue
Block a user