mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-17 23:32:10 +00:00
Mala poprawka na rozmiar plikow pamieci
This commit is contained in:
@@ -147,7 +147,12 @@ async def on_message(message):
|
|||||||
#wentylacja
|
#wentylacja
|
||||||
if message.channel.id == 1083804024173764739:
|
if message.channel.id == 1083804024173764739:
|
||||||
return
|
return
|
||||||
|
#legendy
|
||||||
|
if message.channel.id == 1084448332841230388:
|
||||||
|
return
|
||||||
|
#interrogation booth
|
||||||
|
if message.channel.id == 1111625221171052595:
|
||||||
|
return
|
||||||
if isinstance(message.channel, discord.DMChannel):
|
if isinstance(message.channel, discord.DMChannel):
|
||||||
channel = client.get_channel(1064888712565100614)
|
channel = client.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)
|
||||||
@@ -155,7 +160,7 @@ async def on_message(message):
|
|||||||
channel = message.channel
|
channel = message.channel
|
||||||
await client.process_commands(message)
|
await client.process_commands(message)
|
||||||
|
|
||||||
# wpiac jego reakcje we framework chatu GPT
|
#TODO: wpiac jego reakcje we framework chatu GPT
|
||||||
message.content = message.content.lower()
|
message.content = message.content.lower()
|
||||||
|
|
||||||
tdelta = datetime.now() - master_timeout
|
tdelta = datetime.now() - master_timeout
|
||||||
@@ -168,13 +173,12 @@ 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):
|
||||||
# if word in 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]
|
||||||
if tdelta > word_reactions[word][1]:
|
if tdelta > word_reactions[word][1]:
|
||||||
# to zrobic reactiony
|
#TODO: to zrobic reactiony
|
||||||
logger.info("Ping z procedury reakcji")
|
logger.info("Ping z procedury reakcji")
|
||||||
if reaction:
|
if reaction:
|
||||||
emoji = client.get_emoji(word_reactions[word][0])
|
emoji = client.get_emoji(word_reactions[word][0])
|
||||||
@@ -336,14 +340,47 @@ async def check():
|
|||||||
voiceClient = client.voice_clients[0]
|
voiceClient = client.voice_clients[0]
|
||||||
if voiceClient.is_connected():
|
if voiceClient.is_connected():
|
||||||
global MUZYKA
|
global MUZYKA
|
||||||
while MUZYKA["playing"]:
|
while MUZYKA["playing"] and voiceClient.is_connected():
|
||||||
await asyncio.sleep(10)
|
if voiceClient and not voiceClient.is_playing() and not voiceClient.is_paused():
|
||||||
if 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)
|
||||||
if os.path.getsize(logfile) > 600000:
|
if os.path.getsize(logfile) > 600000:
|
||||||
shutil.copyfile(logfile,"{}discord{}.log".format(logstore, datetime.now()))
|
shutil.copyfile(logfile,"{}discord{}.log".format(logstore, datetime.now()))
|
||||||
logger.info("Log rollover")
|
logger.info("Log rollover")
|
||||||
handler.doRollover()
|
handler.doRollover()
|
||||||
|
|
||||||
|
if os.path.getsize(memory_five_muzyka) > 300000:
|
||||||
|
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....*")
|
||||||
|
with channel.typing():
|
||||||
|
path_newfile = "{}{}{}.json".format(logstore, memory_five_muzyka[:-4],datetime.now())
|
||||||
|
with open(memory_five_muzyka, "r+") as file:
|
||||||
|
with open(path_newfile, "x") as new_file:
|
||||||
|
# First we load existing data into a dict.
|
||||||
|
file_data = json.load(file)
|
||||||
|
new_data = []
|
||||||
|
new_data.append(file_data[0])
|
||||||
|
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)
|
||||||
|
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())
|
||||||
|
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(path_newfile, "x") as new_file:
|
||||||
|
# First we load existing data into a dict.
|
||||||
|
file_data = json.load(file)
|
||||||
|
new_data = []
|
||||||
|
new_data.append(file_data[0])
|
||||||
|
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)
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user