Move code to the right place.
This commit is contained in:
parent
b05af57b54
commit
19fff428cd
|
@ -5,16 +5,12 @@ health-checker runs simple health checks on a portal node using the siad API and
|
||||||
dispatches messages to a Discord channel.
|
dispatches messages to a Discord channel.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import discord, traceback, asyncio
|
import discord, traceback
|
||||||
from bot_utils import setup, send_msg, siad, sc_precision
|
from bot_utils import setup, send_msg, siad, sc_precision
|
||||||
|
|
||||||
bot_token = setup()
|
bot_token = setup()
|
||||||
client = discord.Client()
|
client = discord.Client()
|
||||||
|
|
||||||
async def exit_after(delay):
|
|
||||||
await asyncio.sleep(delay)
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import discord, sys, traceback, io, os
|
import discord, sys, traceback, io, os, asyncio
|
||||||
from bot_utils import setup, send_msg, sc_precision
|
from bot_utils import setup, send_msg, sc_precision
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
@ -24,9 +24,16 @@ DEFAULT_CHECK_INTERVAL = 1
|
||||||
bot_token = setup()
|
bot_token = setup()
|
||||||
client = discord.Client()
|
client = discord.Client()
|
||||||
|
|
||||||
|
|
||||||
|
async def exit_after(delay):
|
||||||
|
await asyncio.sleep(delay)
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
await run_checks()
|
await run_checks()
|
||||||
|
asyncio.create_task(exit_after(10))
|
||||||
await client.close()
|
await client.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue