Funkcjonalnosc logowania incydentow w Absinth Eldritch Horror

Hammertimespace Continuum
This commit is contained in:
2023-06-10 14:35:54 +02:00
committed by migatu
parent d2e5a34b87
commit 5505022dbb
+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)