-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba97855
commit dcdd6d9
Showing
6 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
Submodule discord
deleted from
b0e013
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
worker: python discord_bot.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# bot.py | ||
import os | ||
import random | ||
|
||
import discord | ||
from dotenv import load_dotenv | ||
|
||
from sugaroid.sugaroid import Sugaroid | ||
|
||
load_dotenv() | ||
token = os.getenv('DISCORD_TOKEN') | ||
sg = Sugaroid() | ||
client = discord.Client() | ||
|
||
@client.event | ||
async def on_ready(): | ||
print(f'{client.user.name} has connected to Discord!') | ||
|
||
@client.event | ||
async def on_member_join(member): | ||
await member.create_dm() | ||
await member.dm_channel.send( | ||
f'Hi {member.name}, welcome to my Discord server!' | ||
) | ||
|
||
@client.event | ||
async def on_message(message): | ||
if message.author == client.user: | ||
return | ||
|
||
if message.content.startswith('<@684746563540484099>') or message.content.startswith('<@!684746563540484099>'): | ||
msg = message.content.replace('<@684746563540484099>', '').replace('<@!684746563540484099>', '') | ||
response = sg.parse(msg) | ||
if len(str(response)) > 1999: | ||
response = str(response)[:1999] | ||
await message.channel.send(response) | ||
else: | ||
print(message.content) | ||
|
||
|
||
client.run(token) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
stopwords | ||
wordnet | ||
vader_lexicon | ||
punkt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz | ||
discord.py | ||
python-dotenv | ||
-e git://github.com/srevinsaju/sugaroid.git#egg=sugaroid | ||
Django | ||
gunicorn | ||
django_heroku | ||
freegames | ||
wikipedia-api | ||
mediawikiapi | ||
git+git://github.com/gunthercox/chatterbot-corpus.git#egg=chatterbot-corpus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python-3.8.1 |