Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
898e9c2
Correct token code. Still not working, likely a server bug.
Jun 11, 2021
8b78eee
Updated requirements. Server token working (needed to not use venv).
Jun 11, 2021
c43cdc2
Merge branch 'MLH-Fellowship:main' into main
georgeamccarthy Jun 11, 2021
9f307d4
Correct requirements
Jun 11, 2021
6d93ffc
Correct requirements
Jun 11, 2021
8172372
Merge pull request #14 from joeyouss/main
SaurabhAgarwala Jun 11, 2021
7323d90
Fix server token and update requirements. (#13)
georgeamccarthy Jun 11, 2021
76013d7
Fix requirements
Jun 11, 2021
511adb5
Fix requirements
Jun 11, 2021
139602c
Merge branch 'main' into main
georgeamccarthy Jun 11, 2021
147b3f2
Merge pull request #16 from georgeamccarthy/main
georgeamccarthy Jun 11, 2021
148d6fe
Add help text to commands
SaurabhAgarwala Jun 11, 2021
3b75027
Update help text of FAQs
SaurabhAgarwala Jun 11, 2021
ddcca4b
Update README.md
georgeamccarthy Jun 11, 2021
9a17905
Merge pull request #17 from MLH-Fellowship/update-helptext
georgeamccarthy Jun 11, 2021
e913260
Update README.md
SaurabhAgarwala Jun 11, 2021
8d5d9a0
Update README.md
georgeamccarthy Jun 15, 2021
acd4139
added ruby version of discord bot
Sep 2, 2021
27b56e8
added REST API usage in ruby
Sep 2, 2021
0b31569
added scraping handbook feature
Sep 2, 2021
cca81f9
added sentimental analysis for bot and google translate
Sep 3, 2021
04ab04d
added IBM watson API
Sep 3, 2021
f553462
updated readme
Sep 3, 2021
1ca820c
hmm idk
Sep 3, 2021
06f7199
reverted back to event changes to make code cleaner
joeyouss Sep 15, 2021
cd53037
watson API compromised
joeyouss Sep 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ google-calendar-quickstart.py
credentials.json
token.json
ok.json
faq.json
77 changes: 52 additions & 25 deletions mentalHealthBot.py → FellowBot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#Google Calendar API imports
#!/usr/bin/env python3
from motivation import get_motivation, refresh_reddit_token
from connect_database import update_mood, get_moods
from mood import tone_result
from weekly_mood import weekly_moods
from google_translate import google_translate
from watson import reload_watson_api

from __future__ import print_function
import datetime
import os.path
Expand All @@ -9,33 +17,36 @@

import json
import os
import discord
import requests
from discord.ext import commands
import random
from keepalive import keepalive

from discord.ext import commands
# enter token for the server
TOKEN = os.getenv('DISCORD_TOKEN')
# enter application id

# client = commands.Bot(command_prefix='.')
# TOKEN = os.environ['DISCORD_TOKEN'] # to use in repl

import discord
from discord.ext import commands
# from dotenv import load_dotenv
# load_dotenv()
# TOKEN = os.getenv('DISCORD_TOKEN')
from discord.ext import commands, tasks

# If modifying these scopes, delete the file token.json.
SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']
import datetime
import json
import random
import os

TEST = True

# ---------------------BOT COMMAND
bot = commands.Bot(command_prefix='!')
# ---------------------WEB SCRAPING
scraping = open("ok.json", encoding="UTF-8")
scraping = open("faq.json", encoding="UTF-8")
scraped = json.load(scraping)
announcement_channels_list = []

# If modifying these scopes, delete the file token.json.
SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']


# ----------------FOR HELPLINE
helplines = ["Family Violence Prevention Center 1-800-313-1310",
"National Sexual Assault Hotline 1-800-656-HOPE (4673)",
Expand All @@ -45,7 +56,7 @@
"GriefShare 1-800-395-5755",
"Suicide Hotline 1-800-SUICIDE (784-2433)"]

@bot.command(aliases=['event', 'nextevent', 'nextevents', 'upcomingevent', 'upcomingevents'], help='Get a list of the ongoing and upcoming events of the pod')
@bot.command(aliases=['event', 'nextevent', 'nextevents', 'upcomingevent', 'upcomingevents'], help='Get a list of the ongoing and upcoming events of the pod. Enter the count of events to retrieve following the command. It\'s default value is 1.')
async def events(ctx, count='1'):
creds = None
# The file token.json stores the user's access and refresh tokens, and is
Expand Down Expand Up @@ -107,7 +118,22 @@ async def events(ctx, count='1'):
# await ctx.send(event['description'])


@bot.command(name='faq', help='Searches the FAQ for the most relevant section corresponding to the provided keyword.')
@bot.command(name='faq', help="\
Searches the FAQ for the most relevant section corresponding to the provided keyword. List of keywords: \
- 😄 **MLHintro** - For in depth introduction to MLH fellowship. \
- 🌲 **MLHevents**- What are MLH events? Know everything about them. \
- 🚂 **pods** - What are pods? Know everything here \
- 📱 **discord** -How to use discord and which channel serves what purpose \
- 📞 **zoom**- What is zoom used for? \
- 📢 **feedback** - What is feedback in MLH? \
- ⏰ **remote** - How to work remotely and give your 100% in MLH. \
- 📏 **hackathonrules** - Rules for hackathons \
- 🥇 **hackjudge** - How do judges make a decision for hackathon winner? What is taken into consideration? \
- 💯 **hackdemo** - How to prepare a good demo for hackathon? \
- 🙋 **attendance** - What is the importance of attendance in MLH and how is it monitored?\
- 💁 **expectations** - What MLH expects from you as fellows\
- ⛑️ **help** - Facing problems in MLH? Reach out to us\
")
async def faq(ctx, keyword):
for i in scraped["intents"]:
if(keyword==i["tag"]):
Expand All @@ -118,37 +144,37 @@ async def faq(ctx, keyword):
await ctx.send(response)


@bot.command(aliases=['al'])
@bot.command(aliases=['al'], help="Get all helpline numbers related to mental health")
async def all(ctx):
for i in helplines:
res = i
await ctx.send(res)

@bot.command(aliases=['depression'])
@bot.command(aliases=['depression'], help="Get helpline number to tackle depression and suicidal thoughts")
async def suicide(ctx):
await ctx.send(helplines[6])

@bot.command(aliases=['violenT'])
@bot.command(aliases=['violent'], help="Get helpline number to tackle violence")
async def violence(ctx):
await ctx.send(helplines[0])

@bot.command(aliases=['drugs'])
@bot.command(aliases=['drugs'], help="Get helpline number to tackle drug addiction")
async def drugabuse(ctx):
await ctx.send(helplines[2])

@bot.command(aliases=['assault'])
@bot.command(aliases=['assault'], help="Get helpline number to tackle assaults")
async def sexualAssault(ctx):
await ctx.send(helplines[1])

@bot.command(aliases=['ILLNESS'])
@bot.command(aliases=['ILLNESS'], help="Get helpline number to tackle illness")
async def cancer(ctx):
await ctx.send(helplines[3])

@bot.command(aliases=['grie'])
@bot.command(aliases=['sorrow'], help="Get helpline number to tackle grief")
async def grief(ctx):
await ctx.send(helplines[5])

@bot.command(aliases=['eating'])
@bot.command(aliases=['eating'], help="Get helpline number to tackle eating disorder")
async def eatingdisorder(ctx):
await ctx.send(helplines[4])

Expand Down Expand Up @@ -189,9 +215,7 @@ async def eatingdisorder(ctx):
]

# -------------------------TRIGGERING BOT EVENT
@bot.event
async def on_ready():
print('Bot is ready.')

#-------------------------RANDOM QUOTE SUGGESTION
def get_qoute():
response = requests.get("https://zenquotes.io/api/random")
Expand Down Expand Up @@ -249,5 +273,8 @@ async def on_message(message):
# REPEATEDLY PING SERVER TO KEEP ALIVE
#keepalive()

checkin_announcement.start()
reload_tokens.start()

# ---------------------INITIALIZING THE BOT
bot.run(TOKEN)
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# FellowBot
# FellowBot 🤖
### MLH kick-off hackathon Project - FellowBuddy Discord Bot

#### Check out the FellowBot website [here](https://mlh-fellowship.github.io/FellowBot/)
## **Hi there ! :wave:**

![Cover](Fb.gif)
<div align="center" style="height : 800px">
Talk 💠 Get help 💠 Scrape!
</div>

## Note : Ruby version of this bot resides in ./fellowbot.rb file
## Note : movierecsys feature of the discord bot can be found in this [repo](https://github.com/joeyouss/Movierecsys_Joebot)
## Note : sentimental analysis to make bot more dynamic is now supported.
### **This is FellowBot - an MLH kickoff project, a bot and your friend!.**

We understand how sometimes life in particular can be difficult and since we are now MLH Fellows, we thought of making something which can be used by every fellow in the server and which makes their life easy.
Expand All @@ -26,6 +28,7 @@ We understand how sometimes life in particular can be difficult and since we are
The project is a discord bot with the following features:
- 🧠 Mental health support - We understand how stressful it can be to manage everything and keep a positive attitude. Come talk to FellowBot about stress, life and unwanted feelings and it will help you!. Have difficulty managinng time? It will recommend you techniques to stay focused. Having a bad day? It will tell you a joke too!. Want motivation? Well, FellowBot will send you an inspiational quote too!.
- ✨ Handbook scraping - We understand that you might not remember every page of the handbook but we also agree it is your best friend in this fellowship!. So, need to search for a particular page? Just type in a relevant keyword from our list of keywords and have the information directly in your discord. Say goodbye to searches again!
- 📅 Next events - There are many events which fellows in MLH have to attend. Spending most of their time in Discord, there must be a way to get it directly there. Voila! Just use our FellowBot to get a list of a few ongoing/upcoming events.


## Techstack
Expand All @@ -34,6 +37,8 @@ The project is a discord bot with the following features:
- 🥣 Beautiful Soup- To scrape the data beautifully.
- 🛌 REST APIs - to fetch quotes and jokes for the fellows
- 🐍 Python - The beautiful language to write our dynamic code.
- 🎆 Google API: The calendar API for getting the events
- 📄 GitHub Pages: For hosting the FellowBot wesbite

## Bot commands
### Functionality 1 -> answering your MLH handbook related questions
Expand All @@ -59,6 +64,9 @@ The project is a discord bot with the following features:
### Functionality 3 -> Emergency Hotline numbers
Use ![your emergency] to trigger out helper bot or just enter **!all** to get every helpline number.

### Functionality 4 -> Get upcoming event(s) info
Use !event [count] to get a list of the ongoing and upcoming events of the pod. Enter the count of events to retrieve following the command. It's default value is 1.

## Scalability 🌺
The project can be scaled to fulfill huge possibilities. The current scalable paths comprise of :
- Extending the functionality to make the bot more dynamic i.e. text summarization for cosine similarity between asked questions. This will enable us to make our bot more useful.
Expand All @@ -75,6 +83,11 @@ The project can be scaled to fulfill huge possibilities. The current scalable pa
- copy the link in your own browser and authorize the bot.
- Voila! Your bot is ready!

## Adding the bot to your server
- Enter your server token in the FellowBot website to add the bot your server
- Make a PR with your details in `Fellows.csv` to get access to confidential information restricted to MLH Fellows
- Yippee! You are done.

## Contributing 👬
Being open-source fellows, we used this opportunity to invite contributions from the whole MLH family!. The project is hence hosted as open source and you are welcome to make it more scalable and better !

Expand All @@ -83,3 +96,5 @@ We agree that the handbook should be of use to the MLH fellows hence the bot sho

## What we are proud of ? 🥳
Since none of us had any idea about creating Discord bot, the hard work we have put in and the hours we spent on coding made us believe what we as a team can do. Even though we were running late by 2 days, we still decided to start a new project from scratch since it was more useful and ambitious. The experience was thrilling and we had/still having fun coding the project !

Created by Jyoti Bisht, Saurabh Agarwala and George A. McCarthy as part of the MLH summer 2021 orientation week hackathon.
3 changes: 3 additions & 0 deletions config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ODgyNjk3NjU0MzQ4NDQ3Nzc0.YS_KQA.D9dTYYAKFm2bLTkpZ8hI8bN5NMs
882697654348447774
!
Loading