mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-18 15:52:10 +00:00
Reakcje ladacznicy, poprawka na mention w reset the clock
This commit is contained in:
@@ -43,7 +43,7 @@ if platform == "linux" or platform == "linux2":
|
|||||||
settings_file = "/home/pi/Conjurer/settings.json"
|
settings_file = "/home/pi/Conjurer/settings.json"
|
||||||
netrc_file = "/home/pi/.netrc"
|
netrc_file = "/home/pi/.netrc"
|
||||||
logstore = "/home/pi/RetroPie/logs/"
|
logstore = "/home/pi/RetroPie/logs/"
|
||||||
accident_log = "/home/pi/accident_log.json"
|
accident_log = "/home/pi/Conjurer/accident_log.json"
|
||||||
|
|
||||||
elif platform == "win32":
|
elif platform == "win32":
|
||||||
logfile = "discord.log"
|
logfile = "discord.log"
|
||||||
@@ -176,7 +176,6 @@ async def on_message(message):
|
|||||||
if tdelta > INITIAL_TIME_WAIT:
|
if tdelta > INITIAL_TIME_WAIT:
|
||||||
for word in word_reactions:
|
for word in word_reactions:
|
||||||
if re.search(".*" + word + "[\s*,$]*", message.content):
|
if re.search(".*" + word + "[\s*,$]*", message.content):
|
||||||
|
|
||||||
tdelta = datetime.now() - word_reactions[word][2]
|
tdelta = datetime.now() - word_reactions[word][2]
|
||||||
tdelta = tdelta.total_seconds()
|
tdelta = tdelta.total_seconds()
|
||||||
reaction = word_reactions[word][3]
|
reaction = word_reactions[word][3]
|
||||||
@@ -344,7 +343,11 @@ async def check():
|
|||||||
if voiceClient.is_connected():
|
if voiceClient.is_connected():
|
||||||
global MUZYKA
|
global MUZYKA
|
||||||
while MUZYKA["playing"] and voiceClient.is_connected():
|
while MUZYKA["playing"] and voiceClient.is_connected():
|
||||||
if voiceClient and not voiceClient.is_playing() and not voiceClient.is_paused():
|
if (
|
||||||
|
voiceClient
|
||||||
|
and not voiceClient.is_playing()
|
||||||
|
and not voiceClient.is_paused()
|
||||||
|
):
|
||||||
await play(MUZYKA["ctx"], MUZYKA["requestor"])
|
await play(MUZYKA["ctx"], MUZYKA["requestor"])
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
if os.path.getsize(logfile) > 600000:
|
if os.path.getsize(logfile) > 600000:
|
||||||
@@ -354,9 +357,13 @@ async def check():
|
|||||||
|
|
||||||
if os.path.getsize(memory_five_muzyka) > 300000:
|
if os.path.getsize(memory_five_muzyka) > 300000:
|
||||||
channel = client.get_channel(1062047571557744721)
|
channel = client.get_channel(1062047571557744721)
|
||||||
await channel.send("*Conjurer porządkuje bar, wypala szklanki do czysta miotaczem płomieni ze swojej zbroi i ogólnie wygląda na zajętego....*")
|
await channel.send(
|
||||||
|
"*Conjurer porządkuje bar, wypala szklanki do czysta miotaczem płomieni ze swojej zbroi i ogólnie wygląda na zajętego....*"
|
||||||
|
)
|
||||||
with channel.typing():
|
with channel.typing():
|
||||||
path_newfile = "{}{}{}.json".format(logstore, memory_five_muzyka[:-4],datetime.now())
|
path_newfile = "{}{}{}.json".format(
|
||||||
|
logstore, memory_five_muzyka[:-4], datetime.now()
|
||||||
|
)
|
||||||
with open(memory_five_muzyka, "r+") as file:
|
with open(memory_five_muzyka, "r+") as file:
|
||||||
with open(path_newfile, "x") as new_file:
|
with open(path_newfile, "x") as new_file:
|
||||||
# First we load existing data into a dict.
|
# First we load existing data into a dict.
|
||||||
@@ -369,10 +376,16 @@ async def check():
|
|||||||
new_file.seek(0)
|
new_file.seek(0)
|
||||||
json.dump(new_data, file, indent=4)
|
json.dump(new_data, file, indent=4)
|
||||||
json.dump(file_data, new_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!")
|
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:
|
if os.path.getsize(memory_five_siara) > 300000:
|
||||||
path_newfile = "{}{}{}.json".format(logstore, memory_five_siara[:-4],datetime.now())
|
path_newfile = "{}{}{}.json".format(
|
||||||
await channel.send("*Conjurer porządkuje bar, ścina lekkim laserem pulsacyjnym powierzchnie baru o grubości kilku mikronów i ogólnie wygląda na zajętego....*")
|
logstore, memory_five_siara[:-4], datetime.now()
|
||||||
|
)
|
||||||
|
await channel.send(
|
||||||
|
"*Conjurer porządkuje bar, ścina lekkim laserem pulsacyjnym powierzchnie baru o grubości kilku mikronów i ogólnie wygląda na zajętego....*"
|
||||||
|
)
|
||||||
with open(memory_five_siara, "r+") as file:
|
with open(memory_five_siara, "r+") as file:
|
||||||
with open(path_newfile, "x") as new_file:
|
with open(path_newfile, "x") as new_file:
|
||||||
# First we load existing data into a dict.
|
# First we load existing data into a dict.
|
||||||
@@ -385,7 +398,9 @@ async def check():
|
|||||||
# convert back to json.
|
# convert back to json.
|
||||||
json.dump(new_data, file, indent=4)
|
json.dump(new_data, file, indent=4)
|
||||||
json.dump(file_data, new_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 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)
|
await asyncio.sleep(60)
|
||||||
|
|
||||||
|
|
||||||
@@ -659,7 +674,6 @@ async def wyszukaj(ctx, how_many=0):
|
|||||||
return return_list
|
return return_list
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def max_weight(list):
|
async def max_weight(list):
|
||||||
max_weight = 0
|
max_weight = 0
|
||||||
for iter in list:
|
for iter in list:
|
||||||
@@ -1001,34 +1015,42 @@ async def przytul(ctx, arg=None):
|
|||||||
async def get_image_stable_diffusion(ctx, arg=None):
|
async def get_image_stable_diffusion(ctx, arg=None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@client.command()
|
@client.command()
|
||||||
async def fabryczka(ctx, arg=None):
|
async def fabryczka(ctx, arg=None):
|
||||||
await ctx.message.reply(historia_fabryczki)
|
await ctx.message.reply(historia_fabryczki)
|
||||||
|
|
||||||
|
|
||||||
@client.command()
|
@client.command()
|
||||||
async def chata_hammera(ctx, arg=None):
|
async def chata_hammera(ctx, arg=None):
|
||||||
with open("accident_log.json", "r+") as new_file:
|
with open(accident_log, "r+") as new_file:
|
||||||
# First we load existing data into a dict.
|
# First we load existing data into a dict.
|
||||||
file_data = json.load(new_file)
|
file_data = json.load(new_file)
|
||||||
opis = file_data[-1][0]
|
opis = file_data[-1][0]
|
||||||
czas = datetime.strptime(file_data[-1][1],'%Y-%m-%d %H:%M:%S.%f')
|
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))
|
await ctx.send(
|
||||||
@client.command()
|
"Komenda mierząca incydenty w Eldritch AbsinthHammerTimeSpaceContinuum.\n 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):
|
async def historia_incydentow_u_hammera(ctx, arg=None):
|
||||||
with open("accident_log.json", "r+") as new_file:
|
with open(accident_log, "r+") as new_file:
|
||||||
# First we load existing data into a dict.
|
# First we load existing data into a dict.
|
||||||
file_data = json.load(new_file)
|
file_data = json.load(new_file)
|
||||||
return_data = "Historia zarejestrownych incydentów u Hammera:\n"
|
return_data = "Komenda mierząca incydenty w Eldritch AbsinthHammerTimeSpaceContinuum.\n Historia zarejestrownych incydentów u Hammera:\n"
|
||||||
index = 1
|
index = 1
|
||||||
for data in file_data:
|
for data in file_data:
|
||||||
opis = data[0]
|
opis = data[0]
|
||||||
czas = datetime.strptime(data[1],'%Y-%m-%d %H:%M:%S.%f')
|
czas = datetime.strptime(data[1], "%Y-%m-%d %H:%M:%S.%f")
|
||||||
add_data = "{}. Opis: {} Data: {}".format(index, opis, czas)
|
add_data = "{}. Opis: {} Data: {}".format(index, opis, czas)
|
||||||
return_data = return_data + add_data + "\n"
|
return_data = return_data + add_data + "\n"
|
||||||
index += 1
|
index += 1
|
||||||
await ctx.send(return_data)
|
await ctx.send(return_data)
|
||||||
|
|
||||||
|
|
||||||
@client.command()
|
@client.command()
|
||||||
async def reset_the_clock(ctx, arg=None):
|
async def reset_the_clock(ctx, arg=None):
|
||||||
hammer = False
|
hammer = False
|
||||||
@@ -1036,19 +1058,28 @@ async def reset_the_clock(ctx, arg=None):
|
|||||||
if role.name == "Bartender":
|
if role.name == "Bartender":
|
||||||
hammer = True
|
hammer = True
|
||||||
if hammer:
|
if hammer:
|
||||||
with open("accident_log.json", "r+") as new_file:
|
with open(accident_log, "r+") as new_file:
|
||||||
# First we load existing data into a dict.
|
# First we load existing data into a dict.
|
||||||
file_data = json.load(new_file)
|
file_data = json.load(new_file)
|
||||||
czas = datetime.strptime(file_data[-1][1],'%Y-%m-%d %H:%M:%S.%f')
|
czas = datetime.strptime(file_data[-1][1], "%Y-%m-%d %H:%M:%S.%f")
|
||||||
opis = ctx.message.content[16:]
|
opis = ctx.message.content[16:]
|
||||||
accident = accident = [opis, "{}".format(datetime.now())]
|
accident = accident = [opis, "{}".format(datetime.now())]
|
||||||
file_data.append(accident)
|
file_data.append(accident)
|
||||||
new_file.seek(0)
|
new_file.seek(0)
|
||||||
# convert back to json.
|
# convert back to json.
|
||||||
json.dump(file_data, new_file, indent=4)
|
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))
|
await ctx.send(
|
||||||
|
"Komenda mierząca incydenty w Eldritch AbsinthHammerTimeSpaceContinuum.\n RESET THE CLOCK. Od ostatniego incydentu w chacie Hammera minęło {}. No ale teraz się odpierdoliło: {}".format(
|
||||||
|
czas, opis
|
||||||
|
)
|
||||||
|
)
|
||||||
else:
|
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)))
|
await ctx.send(
|
||||||
|
"Komenda mierząca incydenty w Eldritch AbsinthHammerTimeSpaceContinuum.\n 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).mention
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# *================================== Run
|
# *================================== Run
|
||||||
client.run(TOKEN)
|
client.run(TOKEN)
|
||||||
|
|||||||
Reference in New Issue
Block a user