lunarflu HF staff commited on
Commit
a48b9b8
1 Parent(s): 7a02628

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -174,11 +174,12 @@ async def post_to_slack(author, content, channel, url, slack_mention, trigger):
174
 
175
  # runs discord bot in thread = helps avoid blocking calls
176
  async def run_bot():
177
- async with bot:
178
- bot.loop.create_task(collect_pings())
179
- bot.run(DISCORD_TOKEN)
180
  def start_bot_thread():
181
- asyncio.run(run_bot())
 
 
182
  threading.Thread(target=start_bot_thread).start()
183
  def greet(name):
184
  return "Hello " + name + "!"
 
174
 
175
  # runs discord bot in thread = helps avoid blocking calls
176
  async def run_bot():
177
+ bot.loop.create_task(collect_pings())
178
+ await bot.start(DISCORD_TOKEN)
 
179
  def start_bot_thread():
180
+ loop = asyncio.new_event_loop()
181
+ asyncio.set_event_loop(loop)
182
+ loop.run_until_complete(run_bot())
183
  threading.Thread(target=start_bot_thread).start()
184
  def greet(name):
185
  return "Hello " + name + "!"