fixed crash, for good this time
This commit is contained in:
parent
344df8ff3e
commit
ddcd2bc559
10
fouras.py
10
fouras.py
@ -122,7 +122,7 @@ def poil_auquel(ch:str)->str:
|
|||||||
return random.choice(client.rhyme_strings[key])
|
return random.choice(client.rhyme_strings[key])
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
async def channel_name(channel):
|
async def get_channel_name(channel)->str:
|
||||||
if isinstance(channel, discord.DMChannel):
|
if isinstance(channel, discord.DMChannel):
|
||||||
dm_channel = await client.fetch_channel(channel.id)
|
dm_channel = await client.fetch_channel(channel.id)
|
||||||
return '[DM={0}]'.format(dm_channel.recipient.name)
|
return '[DM={0}]'.format(dm_channel.recipient.name)
|
||||||
@ -183,13 +183,15 @@ async def on_message(message):
|
|||||||
dump = {}
|
dump = {}
|
||||||
cooldowns = {}
|
cooldowns = {}
|
||||||
for key, value in client.cooldown.items():
|
for key, value in client.cooldown.items():
|
||||||
cooldowns[await channel_name(key)] = value - time.time()
|
channel_name = await get_channel_name(key)
|
||||||
dump['poil_au_cooldown'] = client.cooldown
|
cooldowns[channel_name] = value - time.time()
|
||||||
|
dump['poil_au_cooldown'] = cooldowns
|
||||||
for key, value in client.ongoing_riddles.items():
|
for key, value in client.ongoing_riddles.items():
|
||||||
dump_channel = value
|
dump_channel = value
|
||||||
dump_channel.pop("message", None)
|
dump_channel.pop("message", None)
|
||||||
dump_channel['answer'] = '||{0}||'.format(dump_channel['answer'])
|
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))
|
await message.author.send(json.dumps(dump, ensure_ascii=False, indent=4))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user