diff --git a/fouras.py b/fouras.py index 04fc8b7..ee13616 100644 --- a/fouras.py +++ b/fouras.py @@ -122,7 +122,7 @@ def poil_auquel(ch:str)->str: return random.choice(client.rhyme_strings[key]) return '' -async def channel_name(channel): +async def get_channel_name(channel)->str: if isinstance(channel, discord.DMChannel): dm_channel = await client.fetch_channel(channel.id) return '[DM={0}]'.format(dm_channel.recipient.name) @@ -183,13 +183,15 @@ async def on_message(message): dump = {} cooldowns = {} for key, value in client.cooldown.items(): - cooldowns[await channel_name(key)] = value - time.time() - dump['poil_au_cooldown'] = client.cooldown + channel_name = await get_channel_name(key) + cooldowns[channel_name] = value - time.time() + dump['poil_au_cooldown'] = cooldowns for key, value in client.ongoing_riddles.items(): dump_channel = value dump_channel.pop("message", None) dump_channel['answer'] = '||{0}||'.format(dump_channel['answer']) - dump[await channel_name(key)] = dump_channel + channel_name = await get_channel_name(key) + dump[channel_name] = dump_channel await message.author.send(json.dumps(dump, ensure_ascii=False, indent=4)) return