Funkcjonalnosc logowania incydentow w Absinth Eldritch Horror

Hammertimespace Continuum
This commit is contained in:
2023-06-10 14:35:54 +02:00
parent d5bf1182c9
commit f4e0b02c57
2 changed files with 87 additions and 4 deletions
+34
View File
@@ -0,0 +1,34 @@
[
[
"Hammer oparzy\u0142 si\u0119 do II/III stopnia prodi\u017cem",
"2023-05-29 14:00:19.00000"
],
[
"Pat wy\u0142\u0105czy\u0142\u0105 wydruk i wywo\u0142a\u0142a spi\u0119cie na p\u0142ycie g\u0142\u00f3wnej",
"2023-06-01 14:00:43.444444"
],
[
"Pat zala\u0142a \u0142azienk\u0119",
"2023-06-07 20:40:43.453654"
],
[
"Pat przyjeba\u0142a g\u0142ow\u0105 oraz barkiem w drzwi od szafki",
"2023-06-07 22:40:43.453654"
],
[
"Pat oparzy\u0142a si\u0119 kawiark\u0105",
"2023-06-08 11:11:43.453654"
],
[
"Hammer rozci\u0105\u0142 palec trzepi\u0105c przez balkon jeleni\u0105 sk\u00f3r\u0119",
"2023-06-08 18:10:43.453654"
],
[
"Pat zgubi\u0142a w zamkni\u0119tym pomieszczeniu spr\u0119\u017cyn\u0119 od kuchenki gazowej",
"2023-06-08 23:29:43.453654"
],
[
"Hammer kupi\u0142 bilet na 16 zamiast na 09 czerwca",
"2023-06-09 14:52:43.453654"
]
]
+53 -4
View File
@@ -43,6 +43,7 @@ if platform == "linux" or platform == "linux2":
settings_file = "/home/pi/Conjurer/settings.json"
netrc_file = "/home/pi/.netrc"
logstore = "/home/pi/RetroPie/logs/"
accident_log = "/home/pi/accident_log.json"
elif platform == "win32":
logfile = "discord.log"
@@ -53,6 +54,8 @@ elif platform == "win32":
settings_file = "settings.json"
netrc_file = "C:\\Users\\mtusz\\.netrc"
logstore = "C:\\Users\\mtusz\\OneDrive\\Pulpit\\Conjurer\\logs\\"
accident_log = "accident_log.json"
# *=========================================== Keys
netrc = netrc.netrc(netrc_file)
@@ -363,8 +366,9 @@ async def check():
new_data.extend(file_data[:-20])
file.seek(0)
# convert back to json.
json.dump(file_data, file, indent=4)
json.dump(file_data, file, indent=4)
new_file.seek(0)
json.dump(new_data, file, indent=4)
json.dump(file_data, new_file, indent=4)
await channel.send("*Przeciąga się za barem* No dobra - porobione to można dalej pi... *Zauważa spojrzenie Hammera* ...sać powieści o naszym wspaniałym barze SZEFIE!")
if os.path.getsize(memory_five_siara)> 300000:
path_newfile = "{}{}{}.json".format(logstore, memory_five_siara[:-4],datetime.now())
@@ -377,9 +381,10 @@ async def check():
new_data.append(file_data[0])
new_data.extend(file_data[:-20])
file.seek(0)
new_file.seek(0)
# convert back to json.
json.dump(file_data, file, indent=4)
json.dump(file_data, file, indent=4)
json.dump(new_data, file, indent=4)
json.dump(file_data, new_file, indent=4)
await channel.send("*Przeciąga się za barem* No dobra - porobione to można dalej pi... *Zauważa spojrzenie Hammera* eprzyć o głupotach z klientami... Szefie... *Bierze 'ukradkowy' łyk z piersiówki*")
await asyncio.sleep(60)
@@ -1000,6 +1005,50 @@ async def get_image_stable_diffusion(ctx, arg=None):
async def fabryczka(ctx, arg=None):
await ctx.message.reply(historia_fabryczki)
@client.command()
async def chata_hammera(ctx, arg=None):
with open("accident_log.json", "r+") as new_file:
# First we load existing data into a dict.
file_data = json.load(new_file)
opis = file_data[-1][0]
czas = datetime.strptime(file_data[-1][1],'%Y-%m-%d %H:%M:%S.%f')
await ctx.send("Komenda mierząca Eldritch Absinht Horror Hammertimespacecontinuum. Od ostatniego incydentu w chacie Hammera minęło {}. Incydent to: {}".format(datetime.now()-czas,opis))
@client.command()
async def historia_incydentow_u_hammera(ctx, arg=None):
with open("accident_log.json", "r+") as new_file:
# First we load existing data into a dict.
file_data = json.load(new_file)
return_data = "Historia zarejestrownych incydentów u Hammera:\n"
index = 1
for data in file_data:
opis = data[0]
czas = datetime.strptime(data[1],'%Y-%m-%d %H:%M:%S.%f')
add_data = "{}. Opis: {} Data: {}".format(index,opis,czas)
return_data= return_data+ add_data + "\n"
index+=1
await ctx.send(return_data)
@client.command()
async def reset_the_clock(ctx, arg=None):
hammer = False
for role in ctx.message.author.roles:
if role.name == "Bartender":
hammer = True
if hammer:
with open("accident_log.json", "r+") as new_file:
# First we load existing data into a dict.
file_data = json.load(new_file)
czas = datetime.strptime(file_data[-1][1],'%Y-%m-%d %H:%M:%S.%f')
opis = ctx.message.content[16:]
accident= accident = [opis, "{}".format(datetime.now())]
file_data.append(accident)
new_file.seek(0)
# convert back to json.
json.dump(file_data, new_file, indent=4)
await ctx.send("RESET THE CLOCK. Od ostatniego incydentu w chacie Hammera minęło {}. No ale teraz odpierdolił: {}".format(czas, opis))
else:
await ctx.send("Gdzie z łapami do zegara? {} coś albo się komuś stało albo zaraz się stanie jak będzie zegar tykał....".format(client.get_user(346956223645614080)))
# *================================== Run
client.run(TOKEN)