lunarflu HF staff commited on
Commit
423608d
·
verified ·
1 Parent(s): ca9d9a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -172,11 +172,13 @@ async def post_to_slack(author, content, channel, url, slack_mention, trigger):
172
 
173
 
174
  # runs discord bot in thread = helps avoid blocking calls
175
- bot.loop.create_task(collect_pings())
176
-
177
- def run_bot():
178
- bot.run(DISCORD_TOKEN)
179
- threading.Thread(target=run_bot).start()
 
 
180
  def greet(name):
181
  return "Hello " + name + "!"
182
  demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
172
 
173
 
174
  # runs discord bot in thread = helps avoid blocking calls
175
+ async def run_bot():
176
+ async with bot:
177
+ bot.loop.create_task(collect_pings())
178
+ bot.run(DISCORD_TOKEN)
179
+ def start_bot_thread():
180
+ asyncio.run(run_bot())
181
+ threading.Thread(target=start_bpt_thread).start()
182
  def greet(name):
183
  return "Hello " + name + "!"
184
  demo = gr.Interface(fn=greet, inputs="text", outputs="text")