Fahad Mattoo commited on
Commit
410e594
·
unverified ·
1 Parent(s): e6ae968

adding discord hook: (#14)

Browse files

* adding discord hook:

* updating req file

* updating req

* adding secret

.github/workflows/github-ci.yml CHANGED
@@ -53,4 +53,6 @@ jobs:
53
 
54
  - name: Run pytest with coverage
55
  run: |
56
- pytest --cov=src --cov-report=term-missing --cov-branch
 
 
 
53
 
54
  - name: Run pytest with coverage
55
  run: |
56
+ pytest --cov=src --cov-report=term-missing --cov-branch
57
+ env:
58
+ DISCORD_HOOK: ${{ secrets.DISCORD_HOOK }}
requirements.txt CHANGED
@@ -1,2 +1,4 @@
1
  streamlit==1.31.1
2
- openai==1.13.3
 
 
 
1
  streamlit==1.31.1
2
+ openai==1.13.3
3
+ discord-webhook==1.3.1
4
+ python-dotenv==1.0.1
src/app.py CHANGED
@@ -1,9 +1,25 @@
1
  """Module doc string"""
2
 
 
 
3
  import openai
4
  import streamlit as st
 
 
5
  from openai import OpenAI
6
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  def return_true():
9
  """_summary_"""
 
1
  """Module doc string"""
2
 
3
+ import os
4
+
5
  import openai
6
  import streamlit as st
7
+ from discord_webhook import DiscordWebhook
8
+ from dotenv import load_dotenv
9
  from openai import OpenAI
10
 
11
+ load_dotenv()
12
+
13
+
14
+ def discord_hook(message):
15
+ """_summary_"""
16
+ url = os.environ["DISCORD_HOOK"]
17
+ webhook = DiscordWebhook(url=url, username="simple-chat-bot", content=message)
18
+ webhook.execute()
19
+
20
+
21
+ discord_hook("Simple chat bot initiated")
22
+
23
 
24
  def return_true():
25
  """_summary_"""