mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Docstring + bugfixes + random cyclic message
Nowy commit
This commit is contained in:
@@ -183,6 +183,7 @@ with open(MEMORY_FIVE_MUZYKA, "r+", encoding=ENCODING) as temp_music_memory_file
|
||||
with open(SETTINGS_FILE, "r", encoding=ENCODING) as f_settings_file:
|
||||
data = json.load(f_settings_file)
|
||||
word_reactions = data["word_reactions"]
|
||||
cyclic_words = data["cyclic_words"]
|
||||
historia_fabryczki = data["fabryczka"]
|
||||
for key in word_reactions:
|
||||
word_reactions[key][2] = datetime.now()
|
||||
@@ -489,7 +490,16 @@ async def play(ctx, zamawial=None, arg=None):
|
||||
|
||||
async def check():
|
||||
"""Funkcja sprawdzająca czy grać następny kawałek."""
|
||||
last_spontaneous_call = datetime.now()
|
||||
while True:
|
||||
tdelta = datetime.now() - last_spontaneous_call
|
||||
tdelta = tdelta.total_seconds()
|
||||
if tdelta > 34000:
|
||||
channel = client.get_channel(1062047571557744721)
|
||||
last_spontaneous_call = datetime.now()
|
||||
with channel.typing():
|
||||
message = get_random_cyclic_message()
|
||||
await channel.send(message)
|
||||
# trunk-ignore(codespell/misspelled)
|
||||
# TODO: dlaczego sie tu wypierdala
|
||||
if client.voice_clients:
|
||||
@@ -557,6 +567,16 @@ async def check():
|
||||
await asyncio.sleep(60)
|
||||
|
||||
|
||||
async def get_random_cyclic_message():
|
||||
"""
|
||||
The function `get_random_cyclic_message` returns a random cyclic message from a list of cyclic
|
||||
words.
|
||||
:return: a random cyclic message from the list `cyclic_words`.
|
||||
"""
|
||||
messnum = random.randint(0, len(cyclic_words)-1)
|
||||
return cyclic_words[messnum][0]
|
||||
|
||||
|
||||
# trunk-ignore(pylint/R0914)
|
||||
# trunk-ignore(pylint/R0913)
|
||||
# trunk-ignore(pylint/R0915)
|
||||
|
||||
Reference in New Issue
Block a user